Input add @on-search event

This commit is contained in:
梁灏 2018-06-27 15:40:03 +08:00
parent e2a877c46a
commit 1e17564989
2 changed files with 11 additions and 4 deletions

View file

@ -129,11 +129,11 @@
<Icon type="ios-aperture" slot="prefix" />
</Input>
<br><br><br><br>
<Input v-model="value" search enter-button style="width: 300px" />
<Input v-model="value" search enter-button style="width: 300px" @on-search="hs" />
<br><br>
<Input v-model="value" search style="width: 300px" />
<Input v-model="value" search style="width: 300px" @on-search="hs" />
<br><br>
<Input v-model="value" search enter-button="搜索" style="width: 300px" />
<Input v-model="value" search enter-button="Search" style="width: 300px" @on-search="hs" />
</div>
</template>
<script>
@ -148,6 +148,11 @@
select2: 'com',
select3: 'day'
}
},
methods: {
hs (val) {
console.log(val);
}
}
}
</script>

View file

@ -218,6 +218,7 @@
methods: {
handleEnter (event) {
this.$emit('on-enter', event);
if (this.search) this.$emit('on-search', this.currentValue);
},
handleKeydown (event) {
this.$emit('on-keydown', event);
@ -292,8 +293,9 @@
this.$emit('on-change', e);
},
handleSearch () {
if (this.disable) return false;
if (this.disabled) return false;
this.$refs.input.focus();
this.$emit('on-search', this.currentValue);
}
},
watch: {