效果图:
代码:
<el-form :inline="true" label-width="140px" label-position="right" :model="formInline"
:class="['form', isEdit ? 'contract-form-noedit' : '']">
<el-form-item class="form-item-full event">
<el-button type="primary" @click="btnEdit">编辑</el-button>
</el-form-item>
<el-form-item label-width="auto" label="Approved by">
<el-input v-model="formInline.user" placeholder="Approved by" />
</el-form-item>
<el-form-item label="Activity zone">
<el-select v-model="formInline.region" placeholder="Activity zone">
<el-option label="Zone one" value="shanghai" />
<el-option label="Zone two" value="beijing" />
</el-select>
</el-form-item>
</el-form>
因为代码重复所以这些只写了一份
.form {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.el-form--inline .el-form-item {
flex: 1 0 40%;
align-items: center;
}
//第一行按钮独占一行
.form-item-full {
flex: 100% !important;
}
css设置这些就ok了