赞
踩
1.弹出框动态绑定标题:title
<!-- 新增编辑弹出框 -->
<el-dialog :title="titleMap[dialogStatus]" :visible.sync="dialogFormVisible" :rules="rules" ref="ruleForm">
<el-form>
<el-form-item label="角色" :label-width="formLabelWidth" :rules="[{ required: true, message: '输入角色名', trigger: 'blur' }]">
<el-input v-model="form.roleName" auto-complete="off" style="width: 300px;"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="update('ruleForm')">确 定</el-button>
</div>
</el-dialog>
2.在data中定义
titleMap: {
addEquipment: '新增角色', //根据自己内容定义名字
editEquipment: "编辑角色" //根据自己内容定义名字
},
//新增和编辑弹框标题
dialogStatus: "",
3.在methods中你新增和编辑的绑定的方法中添加如下
//新增
add() {
this.dialogStatus = "addEquipment";
this.dialogFormVisible = true
},
//编辑
handleEdit() {
this.dialogFormVisible = true
this.dialogStatus = "editEquipment"
},
4.这样就实现动态分配标题啦
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。