要实现 el-form-item 在一行内显示,通常需要考虑的是表单的布局方式。Element UI 提供了多种布局方式,包括行内布局(inline layout),这可以实现表单项在一行内显示。 以下是如何实现 el-form-item 一行显示的详细步骤: 确认el-form的inline属性: 要实现行内布局,需要在 el-form 组件上设置 inline 属性为 true。
<template> <el-form :model="form" :rules="rules" ref="formRef"> <el-form-item label="输入框1"> <el-input v-model.number="form.input1" /> </el-form-item> <el-form-item label="输入框2"> <el-input v-model.number="form.input2" /> </el-form-item> <el-button type="prima...
<el-form-item> <el-button type="primary" @click="onSubmit">登录</el-button> <el-button>取消</el-button> </el-form-item> </el-form> </template> <script> export default { data() { return { form: { name: '', pwd:'' } } }, methods: { onSubmit() { console.log('submit!'...
<template> <el-form :model="form" :rules="rules" ref="formRef"> <el-form-item label="输入框1"> <el-input v-model.number="form.input1" /> </el-form-item> <el-form-item label="输入框2"> <el-input v-model.number="form.input2" /> </el-form-item> <el-button type="prima...
el-button> </el-form> </template> <script> export default { setup() { const form = reactive({ input1: '', input2: '', }); const rules = { input1: [ { required: true, message: '请输入输入框1的值', trigger: 'blur' }, { validator: (rule, value, callback) => { if (...
el-button> </el-form> </template> <script> export default { setup() { const form = reactive({ input1: '', input2: '', }); const rules = { input1: [ { required: true, message: '请输入输入框1的值', trigger: 'blur' }, { validator: (rule, value, callback) => { if (...