<el-col :span="12"> <el-form-item label="最新版本号:"> <el-input v-model="form.name" placeholder="请输入"></el-input> </el-form-item> <el-form-item label="发版时间:"> <el-input v-model="form.name" placeholder="请输入"></el-input> </el-form-item> </el-col>同行排列
时间: 2024-02-25 21:52:37 浏览: 139
可以使用 `flex` 布局来实现同行排列。将 `el-col` 设置为 `display: flex;`,并将子元素 `el-form-item` 设置为 `flex: 1;`,就可以实现同行排列的效果。
代码如下:
```html
<el-row>
<el-col :span="12" style="display: flex;">
<el-form-item label="最新版本号:" style="flex: 1;">
<el-input v-model="form.name" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="发版时间:" style="flex: 1;">
<el-input v-model="form.name" placeholder="请输入"></el-input>
</el-form-item>
</el-col>
</el-row>
```
其中,`el-col` 设置为 `display: flex;`,子元素 `el-form-item` 设置为 `flex: 1;`,这样就可以让两个表单项平均分配容器的宽度,实现同行排列的效果。
相关问题
<el-form label-position="left"> <el-row> <el-col :span="4"> <el-form-item label="姓名"> <el-input></el-input> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="年龄"> <el-input></el-input> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="性别"> <el-radio-group> <el-radio label="male">男</el-radio> <el-radio label="female">女</el-radio> </el-radio-group> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="12"> <el-form-item label="地址"> <el-input></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="邮箱"> <el-input></el-input> </el-form-item> </el-col> </el-row> </el-form> 如何使表单的标签显示在左侧
可以通过设置 `label-position` 属性为 "left" 来使表单的标签显示在左侧,具体代码如下:
```html
<el-form label-position="left">
<!-- 表单内容 -->
</el-form>
```
这样表单中每个表单项的标签都会显示在左侧。
如何将以下代码的模板名称,分组名称,分辨率的框的宽度调整为395px, <el-dialog class=“custom-dialog” :title=“title” :visible.sync=“open” @closed=“handleClosed” style=“color: #333333;size: 20px;margin-top: 32px;margin-left: 32px;”> <el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-row> <el-col :span="24"> <el-form-item label="模板名称" prop="name" > <el-input v-model="form.name" placeholder="请输入模板名称" /> </el-form-item> </el-col> <el-col :span="24"> <el-form-item label="分组名称" prop="groupId" > <treeselect v-model="form.groupId" :options="groupOptions.length ? groupOptions[0].children : []" :normalizer="normalizer" placeholder="请选择分组名称" /> </el-form-item> </el-col> <el-col :span="24"> <el-form-item label="分辨率" prop="resolution" > <el-select @change=“handleResolutionChange” v-model=“form.resolution” placeholder=“请输入分辨率”> <el-option v-for="it in resolutionList" :key="it" :label="it" :value="it" /> </el-select> </el-form-item> </el-col> <el-col :span="12" v-if="showCustomResolution"> <el-form-item label="宽度" prop="customWidth"> <el-input v-model="form.customWidth" type="number" placeholder="请输入宽度" /> </el-form-item> </el-col> <el-col :span="12" v-if="showCustomResolution"> <el-form-item label="高度" prop="customWidth"> <el-input v-model="form.customHeight" type="number" placeholder="请输入高度" /> </el-form-item> </el-col> </el-row> </el-form> <el-button type=“primary” @click=“submitForm”>确 定</el-button> <el-button @click=“cancel”>取 消</el-button> </el-dialog>
可以在 el-dialog 标签中添加一个 style 属性,设置宽度为395px,如下所示:
<el-dialog class="custom-dialog" :title="title" :visible.sync="open" @closed="handleClosed" style="color: #333333;size: 20px;margin-top: 32px;margin-left: 32px;width: 395px;">
阅读全文