# table 表单动态显示隐藏select数据源

An image An image

//弹出框打开时,
 modelOpenBefore(row) {
      //动态隐藏、显示下拉框的数据源(2021.05.16更新后volform.vue才能使用)
    this.editFormOptions.forEach(x => {
        x.forEach(item => {
            if (item.field == "字段") {
                //item.data为下拉框数据源选项
                item.data.forEach(kv=>{
                    //设置下拉框选项隐藏
                    // kv.hidden=true;
                    
                    //这里根据实际条件来判断下拉框选项是否显示
                    //如:新建时隐藏某些选项
                    // if(this.currentAction == "Add"){
                    //     if(kv.key=="1"){
                    //         kv.hidden=truel
                    //     }
                    // }

                    //或者根据this.editFormFields的值来判断要隐藏某些字段
                })
            }
        })
    })
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25