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

View File

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