inputTree树型组件

... 2022-9-15 Less than 1 minute

# inputTree树型组件

值:
包含父类值:[ 0, 1, 2, 3, 4 ]
不包含父类值:[ 1, 2, 3 ]
半选是否包含父类值:[]
半选是不包含父类值:[ 2, 1 ]
父子不关联:[ 0 ]
<el-row :span="24">
  <el-col :span="6">
     值:{{form}}<br/>
    <avue-input-tree default-expand-all v-model="form" placeholder="请选择内容" :dic="dic"></avue-input-tree>
  </el-col>
   <el-col :span="24"></el-col>
   <el-col :span="6">
     包含父类值:{{form1}}<br/>
    <avue-input-tree multiple v-model="form1" placeholder="请选择内容"  :dic="dic"></avue-input-tree>
  </el-col>
 <el-col :span="24"></el-col>
   <el-col :span="6">
     不包含父类值:{{form2}}<br/>
    <avue-input-tree leaf-only multiple v-model="form2" placeholder="请选择内容"  :dic="dic"></avue-input-tree>
  </el-col>
   <el-col :span="24"></el-col>
   <el-col :span="6">
     半选是否包含父类值:{{form33}}<br/>
     半选是不包含父类值:{{form3}}<br/>
    <avue-input-tree ref="tree" include-half-checked multiple v-model="form3" placeholder="请选择内容" :dic="dic"></avue-input-tree>
  </el-col>
   <el-col :span="24"></el-col>
   <el-col :span="6">
     父子不关联:{{form4}}<br/>
    <avue-input-tree :check-strictly="true" multiple v-model="form4" placeholder="请选择内容"  :dic="dic"></avue-input-tree>
  </el-col>
</el-row>
<script>
export default {
    data() {
      return {
        form:'',
        form1:[0,1,2,3,4],
        form2:[1,2,3],
        form3:[2,1],
        form33:[],
        form4:[0],
        dic:[{
          label:'选项1',
          value:0,
          children:[{
             label:'选项3',
             value:2
          },{
             label:'选项4',
             value:3
          }]
        },{
          label:'选项2',
          value:1
        }]
      }
    },
    watch:{
      form3:{
        handler() {
          this.form33=this.$refs.tree.getHalfList();
        }
      }
    },
    mounted(){
      this.form33=this.$refs.tree.getHalfList();
    }
}
</script>

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Expand Copy
Last update: October 16, 2022 17:07
Contributors: smallwei
您正在浏览基于 Vue 2.x 的 Avue 文档; 点击这里 查看 Vue 3.x 的升级版本