Blame view

examples/routers/tree.vue 1.77 KB
89f2ba8b   梁灏   init Tree component
1
  <template>
69a10b78   梁灏   fixed #787
2
      <Tree :data="baseData" show-checkbox @on-check-change="handleChange" ></Tree>
89f2ba8b   梁灏   init Tree component
3
4
5
  </template>
  <script>
      export default {
e6c0b158   梁灏   update
6
          data () {
e81207a2   梁灏   update Tree
7
              return {
a9e59197   梁灏   update Tree
8
                  bd: [],
75c32d5f   梁灏   rebuild Tree
9
10
                  baseData: [
                      {
69a10b78   梁灏   fixed #787
11
12
                          title: 'parent',
                          id: '1-0',
e81207a2   梁灏   update Tree
13
                          expand: true,
69a10b78   梁灏   fixed #787
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
                          children: [
                              {
                                  title: 'child1',
                                  id: '1-1',
                                  expand: true,
                                  children: [
                                      {
                                          title: 'child1-1-1',
                                          id: '1-1-1'
                                      },
                                      {
                                          title: 'child1-1-2',
                                          id: '1-1-2'
                                      }
                                  ]
                              },
                              {
                                  title: 'child2',
                                  id: '1-2'
                              }
                          ]
c8157442   梁灏   fixed #499
35
                      }
75c32d5f   梁灏   rebuild Tree
36
                  ]
e81207a2   梁灏   update Tree
37
              }
9d79a51f   梁灏   update Tree
38
39
          },
          methods: {
75c32d5f   梁灏   rebuild Tree
40
41
              handleSelectChange (data) {
                  console.log(data);
69a10b78   梁灏   fixed #787
42
43
44
45
46
47
48
49
              },
              updateTree (data) {
                  data[0].children[0].checked = true;
  //                data[0].children[0].children[0].checked = true;
  //                data[0].children[0].children[1].checked = true;
              },
              handleChange () {
                  console.log(1)
9d79a51f   梁灏   update Tree
50
              }
69a10b78   梁灏   fixed #787
51
52
53
          },
          mounted () {
              this.updateTree(this.baseData);
e81207a2   梁灏   update Tree
54
55
56
          }
      }
  </script>