Blame view

examples/routers/auto-complete.vue 1.13 KB
fed3e09d   梁灏   add AutoComplete ...
1
2
  <template>
      <div style="margin: 100px;width: 200px;">
b575fe2c   梁灏   update AutoComplete
3
          <AutoComplete transfer v-model="value" :data="data" @on-search="handleSearch" @on-change="hc" :filter-method="fm">
fed3e09d   梁灏   add AutoComplete ...
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
              <!--<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: '',
b575fe2c   梁灏   update AutoComplete
19
20
                  data: [],
  //                data: ['Burns Bay Road', 'Downing Street', 'Wall Street']
fed3e09d   梁灏   add AutoComplete ...
21
22
23
24
25
26
27
28
29
30
31
32
              };
          },
          computed: {},
          methods: {
              handleSearch (value) {
                  this.data = !value ? [] : [
                      value + '@qq.com',
                      value + '@sina.com',
                      value + '@163.com'
                  ]
              },
              hc (v) {
7af00356   梁灏   update AutoComplete
33
  //                console.log(v)
fed3e09d   梁灏   add AutoComplete ...
34
35
36
37
38
39
40
              },
              fm (value, item) {
                  return item.toUpperCase().indexOf(value.toUpperCase()) !== -1;
              }
          }
      };
  </script>