Blame view

examples/routers/cascader.vue 1.92 KB
47a7f21d   梁灏   support Cascader
1
  <template>
207d6b07   梁灏   update Cascader I...
2
      <Cascader :data="data4" :load-data="loadData"></Cascader>
0a48ac45   梁灏   Input add readonl...
3
4
  </template>
  <script>
0a48ac45   梁灏   Input add readonl...
5
      export default {
0a48ac45   梁灏   Input add readonl...
6
7
          data () {
              return {
207d6b07   梁灏   update Cascader I...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
                  data4: [
                      {
                          value: 'beijing',
                          label: '北京',
                          children: [],
                          loading: false
                      },
                      {
                          value: 'hangzhou',
                          label: '杭州',
                          children: [],
                          loading:false
                      }
                  ]
              }
          },
          methods: {
              loadData (item, callback) {
                  item.loading = true;
                  setTimeout(() => {
                      if (item.value === 'beijing') {
                          item.children = [
                              {
                                  value: 'talkingdata',
                                  label: 'TalkingData'
                              },
                              {
                                  value: 'baidu',
                                  label: '百度'
                              },
                              {
                                  value: 'sina',
                                  label: '新浪'
                              }
                          ];
                      } else if (item.value === 'hangzhou') {
                          item.children = [
                              {
                                  value: 'ali',
                                  label: '阿里巴巴'
                              },
                              {
                                  value: '163',
                                  label: '网易'
                              }
                          ];
                      }
                      item.loading = false;
                      callback();
                  }, 1000);
47dc36c5   梁灏   fixed Cascader st...
58
              }
0a48ac45   梁灏   Input add readonl...
59
60
          }
      }
c9433dcc   梁灏   optimize Timeline...
61
  </script>