Blame view

src/components/transfer/search.vue 1.16 KB
77f7bb95   梁灏   add Transfer comp...
1
2
3
  <template>
      <div :class="prefixCls">
          <i-input
5b19b5f5   梁灏   support Transfer
4
              v-model="currentQuery"
77f7bb95   梁灏   add Transfer comp...
5
6
7
8
9
10
11
12
13
14
              size="small"
              :icon="icon"
              :placeholder="placeholder"
              @on-click="handleClick"></i-input>
      </div>
  </template>
  <script>
      import iInput from '../input/input.vue';
  
      export default {
5b19b5f5   梁灏   support Transfer
15
          name: 'Search',
2cb8a6d9   梁灏   commit Table comp...
16
          components: { iInput },
77f7bb95   梁灏   add Transfer comp...
17
18
19
20
21
          props: {
              prefixCls: String,
              placeholder: String,
              query: String
          },
5b19b5f5   梁灏   support Transfer
22
23
24
25
26
27
28
29
30
31
32
33
34
          data () {
              return {
                  currentQuery: this.query
              };
          },
          watch: {
              query (val) {
                  this.currentQuery = val;
              },
              currentQuery (val) {
                  this.$emit('on-query-change', val);
              }
          },
77f7bb95   梁灏   add Transfer comp...
35
36
37
38
39
40
41
          computed: {
              icon () {
                  return this.query === '' ? 'ios-search' : 'ios-close';
              }
          },
          methods: {
              handleClick () {
5b19b5f5   梁灏   support Transfer
42
43
44
                  if (this.currentQuery === '') return;
                  this.currentQuery = '';
                  this.$emit('on-query-clear');
afd3509a   梁灏   update Transfer
45
              }
77f7bb95   梁灏   add Transfer comp...
46
          }
b0893113   jingsam   :art: add eslint
47
48
      };
  </script>