Blame view

examples/routers/tree.vue 2.43 KB
89f2ba8b   梁灏   init Tree component
1
  <template>
53754a31   梁灏   fixed #468
2
      <Tree :data="baseData" @on-check-change="handleSelectChange" show-checkbox></Tree>
89f2ba8b   梁灏   init Tree component
3
4
5
  </template>
  <script>
      export default {
e6c0b158   梁灏   update
6
          data () {
e81207a2   梁灏   update Tree
7
              return {
75c32d5f   梁灏   rebuild Tree
8
9
                  baseData: [
                      {
e81207a2   梁灏   update Tree
10
                          expand: true,
75c32d5f   梁灏   rebuild Tree
11
                          title: 'parent 1',
ce03ac52   梁灏   update Tree
12
                          children: [{
75c32d5f   梁灏   rebuild Tree
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
                              title: 'parent 1-0',
                              expand: true,
  //                            disabled: true,
  //                            checked: true,
                              children: [
                                  {
                                      title: 'leaf',
                                      checked: true,
                                      selected: true
                                  },
                                  {
                                      title: 'leaf',
                                      checked: false
                                  }
                              ]
e81207a2   梁灏   update Tree
28
                          }, {
75c32d5f   梁灏   rebuild Tree
29
30
31
32
33
34
35
36
37
                              title: 'parent 1-1',
                              expand: true,
                              checked: true,
                              children: [
                                  {
                                      title: '<span style="color: red">leaf</span>',
                                      checked: false
                                  }
                              ]
e81207a2   梁灏   update Tree
38
                          }]
75c32d5f   梁灏   rebuild Tree
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
                      },
  //                    {
  //                        expand: true,
  //                        title: 'parent 1',
  //                        children: [{
  //                            title: 'parent 1-0',
  //                            expand: true,
  //                            children: [{
  //                                title: 'leaf'
  //                            }, {
  //                                title: 'leaf',
  //                            }]
  //                        }, {
  //                            title: 'parent 1-1',
  //                            expand: true,
  //                            checked: true,
  //                            children: [{
  //                                title: '<span style="color: red">leaf</span>',
  //                            }]
  //                        }]
  //                    }
                  ]
e81207a2   梁灏   update Tree
61
              }
9d79a51f   梁灏   update Tree
62
63
          },
          methods: {
75c32d5f   梁灏   rebuild Tree
64
65
              handleSelectChange (data) {
                  console.log(data);
9d79a51f   梁灏   update Tree
66
              }
e81207a2   梁灏   update Tree
67
68
69
          }
      }
  </script>