Blame view

test/routers/cascader.vue 1.85 KB
0a48ac45   梁灏   Input add readonl...
1
  <template>
c463ab87   梁灏   add Cascader
2
      <div style="margin: 50px;width:300px">
165bb7c9   梁灏   update Cascader
3
4
          {{ value | json }}
          <Cascader size="large" :data="data" :value.sync="value" @on-change="change" trigger="hover" :render-format="format"></Cascader>
6ff31952   梁灏   optimize Input sh...
5
      </div>
0a48ac45   梁灏   Input add readonl...
6
7
  </template>
  <script>
6ff31952   梁灏   optimize Input sh...
8
      import { Cascader } from 'iview';
0a48ac45   梁灏   Input add readonl...
9
10
      export default {
          props: {
c463ab87   梁灏   add Cascader
11
  
0a48ac45   梁灏   Input add readonl...
12
13
14
          },
          data () {
              return {
bd4e3b9b   梁灏   update Cascader
15
16
                  value: ['jiangsu', 'hhh', 'ddd'],
  //                value: [],
c463ab87   梁灏   add Cascader
17
18
19
20
21
22
23
24
25
26
27
28
29
                  data: [{
                      value: 'zhejiang',
                      label: 'Zhejiang',
                      children: [{
                          value: 'hangzhou',
                          label: 'Hangzhou'
                      }],
                  }, {
                      value: 'jiangsu',
                      label: 'Jiangsu',
                      children: [{
                          value: 'nanjing',
                          label: 'Nanjing',
bd4e3b9b   梁灏   update Cascader
30
  //                        disabled: true,
c463ab87   梁灏   add Cascader
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
                          children: [{
                              value: 'zhonghuamen',
                              label: 'Zhong Hua Men',
                              children: [{
                                  value: 'abc',
                                  label: 'ABC'
                              }]
                          }]
                      }, {
                          value: 'hhh',
                          label: 'HHH',
                          children: [{
                              value: 'ddd',
                              label: 'DDD'
                          }]
                      }]
                  }]
0a48ac45   梁灏   Input add readonl...
48
49
50
              }
          },
          computed: {
c463ab87   梁灏   add Cascader
51
  
0a48ac45   梁灏   Input add readonl...
52
53
          },
          methods: {
165bb7c9   梁灏   update Cascader
54
55
56
57
58
59
              change (data, opts) {
                  console.log(data);
                  console.log(opts)
              },
              format (label, data) {
                  return label[label.length - 1];
bd4e3b9b   梁灏   update Cascader
60
              }
0a48ac45   梁灏   Input add readonl...
61
62
63
          }
      }
  </script>