vue 点击增加按钮增加一行下拉框,绑定下拉框值,点击删除按按钮删除对应行
<div><div><el-select class="el-select" v-model="form.label" placeholder="全部" clearablefilterable><el-optionv-for="it
·
<div> <div> <el-select class="el-select" v-model="form.label" placeholder="全部" clearable filterable> <el-option v-for="item in addList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> <span @click="add">新增</span> </div> <div v-for="(item, index) in form" :key="index"> <el-select class="el-select" v-model="item.label" placeholder="全部" clearable filterable> <el-option v-for="item in addList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> <span class="delete" @click="deleteItem(index)">删除</span> </div>
</div>
export default { // 项目管理 name: 'ProjectManageList', mixins: [pageMixin, exportModel], data() { return { form: [ ],
addList: [ { value: '老板', label: '老板' }, { value: '经理', label: '经理' }, { value: '主管', label: '主管' } ]
}
methods: {
add() { this.form.push({}); }, deleteItem(index) { this.form.splice(index, 1); }}
更多推荐
已为社区贡献1条内容
所有评论(0)