Blame view

test/routers/transfer.vue 1.29 KB
77f7bb95   梁灏   add Transfer comp...
1
  <template>
9084eb18   梁灏   fixed #92
2
3
4
      <Transfer
              :data="data2"
              :target-keys="targetKeys2"
77f7bb95   梁灏   add Transfer comp...
5
              filterable
122e69ee   梁灏   update Transfer
6
              :filter-method="filterMethod"
9084eb18   梁灏   fixed #92
7
              @on-change="handleChange2"></Transfer>
77f7bb95   梁灏   add Transfer comp...
8
9
  </template>
  <script>
77f7bb95   梁灏   add Transfer comp...
10
      export default {
77f7bb95   梁灏   add Transfer comp...
11
12
          data () {
              return {
9084eb18   梁灏   fixed #92
13
14
                  data2: this.getMockData(),
                  targetKeys2: this.getTargetKeys()
77f7bb95   梁灏   add Transfer comp...
15
16
              }
          },
77f7bb95   梁灏   add Transfer comp...
17
          methods: {
9084eb18   梁灏   fixed #92
18
19
20
21
22
23
24
25
26
27
28
              getMockData () {
                  let mockData = [];
                  for (let i = 1; i <= 20; i++) {
                      mockData.push({
                          key: i.toString(),
                          label: '内容' + i,
                          description: '内容' + i + '的描述信息',
                          disabled: Math.random() * 3 < 1
                      });
                  }
                  return mockData;
37ee1535   梁灏   update Transfer
29
              },
9084eb18   梁灏   fixed #92
30
31
32
33
34
35
36
              getTargetKeys () {
                  return this.getMockData()
                          .filter(() => Math.random() * 2 > 1)
                          .map(item => item.key);
              },
              handleChange2 (newTargetKeys) {
                  this.targetKeys2 = newTargetKeys;
122e69ee   梁灏   update Transfer
37
              },
9084eb18   梁灏   fixed #92
38
39
              filterMethod (data, query) {
                  return data.label.indexOf(query) > -1;
77f7bb95   梁灏   add Transfer comp...
40
41
42
              }
          }
      }
9084eb18   梁灏   fixed #92
43
  </script>