support Transfer
support Transfer
This commit is contained in:
parent
191068ac0c
commit
5b19b5f55f
8 changed files with 198 additions and 55 deletions
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div :class="prefixCls">
|
||||
<i-input
|
||||
:value.sync="query"
|
||||
v-model="currentQuery"
|
||||
size="small"
|
||||
:icon="icon"
|
||||
:placeholder="placeholder"
|
||||
|
@ -12,12 +12,26 @@
|
|||
import iInput from '../input/input.vue';
|
||||
|
||||
export default {
|
||||
name: 'Search',
|
||||
components: { iInput },
|
||||
props: {
|
||||
prefixCls: String,
|
||||
placeholder: String,
|
||||
query: String
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
currentQuery: this.query
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
query (val) {
|
||||
this.currentQuery = val;
|
||||
},
|
||||
currentQuery (val) {
|
||||
this.$emit('on-query-change', val);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
icon () {
|
||||
return this.query === '' ? 'ios-search' : 'ios-close';
|
||||
|
@ -25,17 +39,19 @@
|
|||
},
|
||||
methods: {
|
||||
handleClick () {
|
||||
if (this.query === '') return;
|
||||
this.query = '';
|
||||
}
|
||||
},
|
||||
events: {
|
||||
'on-form-blur' () {
|
||||
return false;
|
||||
},
|
||||
'on-form-change' () {
|
||||
return false;
|
||||
if (this.currentQuery === '') return;
|
||||
this.currentQuery = '';
|
||||
this.$emit('on-query-clear');
|
||||
}
|
||||
}
|
||||
// todo 事件
|
||||
// events: {
|
||||
// 'on-form-blur' () {
|
||||
// return false;
|
||||
// },
|
||||
// 'on-form-change' () {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue