search add change event

This commit is contained in:
cookfront 2017-03-30 14:47:52 +08:00
parent 2b3394bd35
commit 50d87fa634
2 changed files with 10 additions and 2 deletions

View File

@ -3,6 +3,9 @@ export default {
methods: {
goSearch(value) {
alert(value)
},
handleChange(value) {
console.log(value);
}
}
};
@ -14,7 +17,7 @@ export default {
:::demo 基础用法
```html
<zan-search placeholder="商品名称" @search="goSearch"></zan-search>
<zan-search placeholder="商品名称" @search="goSearch" @change="handleChange"></zan-search>
<script>
export default {
methods: {

View File

@ -22,6 +22,11 @@
type: String
}
},
watch: {
value(val) {
this.$emit('change', val);
}
},
data() {
return {
value: '',