Blame view

examples/routers/auto-complete.vue 1.1 KB
fed3e09d   梁灏   add AutoComplete ...
1
2
3
4
5
6
7
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
  <template>
      <div style="margin: 100px;width: 200px;">
          <AutoComplete transfer v-model="value" :data="data" @on-change="hc" :filter-method="fm">
              <!--<Option v-for="item in data" :value="item" :label="item" :key="item">-->
                  <!--<span style="color: red">{{ item }}</span>-->
              <!--</Option>-->
          </AutoComplete>
      </div>
  </template>
  <script>
  
      export default {
          props: {
  
          },
          data () {
              return {
                  value: '',
  //                data: [],
                  data: ['Burns Bay Road', 'Downing Street', 'Wall Street']
              };
          },
          computed: {},
          methods: {
              handleSearch (value) {
                  this.data = !value ? [] : [
                      value + '@qq.com',
                      value + '@sina.com',
                      value + '@163.com'
                  ]
              },
              hc (v) {
                  console.log(v)
              },
              fm (value, item) {
                  return item.toUpperCase().indexOf(value.toUpperCase()) !== -1;
              }
          }
      };
  </script>