Blame view

examples/routers/tree.vue 1.93 KB
89f2ba8b   梁灏   init Tree component
1
  <template>
141ea1ba   Lawrence Lee   on-toggle-expand ...
2
      <Tree :data="baseData" show-checkbox @on-check-change="handleChange" @on-toggle-expand="showExpand"></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
                          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',
173f1c00   Rijn   skip checking chi...
32
33
                                  id: '1-2',
                                  children: []
69a10b78   梁灏   fixed #787
34
35
                              }
                          ]
c8157442   梁灏   fixed #499
36
                      }
75c32d5f   梁灏   rebuild Tree
37
                  ]
e81207a2   梁灏   update Tree
38
              }
9d79a51f   梁灏   update Tree
39
40
          },
          methods: {
75c32d5f   梁灏   rebuild Tree
41
42
              handleSelectChange (data) {
                  console.log(data);
69a10b78   梁灏   fixed #787
43
44
45
46
47
48
49
50
              },
              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)
141ea1ba   Lawrence Lee   on-toggle-expand ...
51
52
53
              },
              showExpand (payload) {
                  console.log(payload)
9d79a51f   梁灏   update Tree
54
              }
69a10b78   梁灏   fixed #787
55
56
57
          },
          mounted () {
              this.updateTree(this.baseData);
e81207a2   梁灏   update Tree
58
59
60
          }
      }
  </script>