Blame view

examples/routers/tree.vue 2.45 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 {
a9e59197   梁灏   update Tree
8
                  bd: [],
75c32d5f   梁灏   rebuild Tree
9
10
                  baseData: [
                      {
e81207a2   梁灏   update Tree
11
                          expand: true,
75c32d5f   梁灏   rebuild Tree
12
                          title: 'parent 1',
ce03ac52   梁灏   update Tree
13
                          children: [{
75c32d5f   梁灏   rebuild Tree
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
                              title: 'parent 1-0',
                              expand: true,
  //                            disabled: true,
  //                            checked: true,
                              children: [
                                  {
                                      title: 'leaf',
                                      checked: true,
                                      selected: true
                                  },
                                  {
                                      title: 'leaf',
                                      checked: false
                                  }
                              ]
e81207a2   梁灏   update Tree
29
                          }, {
75c32d5f   梁灏   rebuild Tree
30
31
32
33
34
35
36
37
38
                              title: 'parent 1-1',
                              expand: true,
                              checked: true,
                              children: [
                                  {
                                      title: '<span style="color: red">leaf</span>',
                                      checked: false
                                  }
                              ]
e81207a2   梁灏   update Tree
39
                          }]
75c32d5f   梁灏   rebuild Tree
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
                      },
  //                    {
  //                        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
62
              }
9d79a51f   梁灏   update Tree
63
64
          },
          methods: {
75c32d5f   梁灏   rebuild Tree
65
66
              handleSelectChange (data) {
                  console.log(data);
9d79a51f   梁灏   update Tree
67
              }
e81207a2   梁灏   update Tree
68
69
70
          }
      }
  </script>