Commit 7deb144d by amateur

代码修改

1 parent 44351acb
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
directives: { directives: {
wrap: { wrap: {
inserted: function (el, binding, vnode, oldVnode) { inserted: function (el, binding, vnode, oldVnode) {
setTimeout(() => { // setTimeout(() => {
const { arg, value } = binding const { arg, value } = binding
const style = { width: 0, height: 0 } const style = { width: 0, height: 0 }
for (let i = 0; i < el.childNodes.length; i++) { for (let i = 0; i < el.childNodes.length; i++) {
...@@ -127,7 +127,7 @@ export default { ...@@ -127,7 +127,7 @@ export default {
style.width && (el.style.width = `${style.width}px`) style.width && (el.style.width = `${style.width}px`)
style.height && (el.style.height = `${style.height}px`) style.height && (el.style.height = `${style.height}px`)
}, 0); // }, 0);
} }
} }
} }
......
<template> <template>
<form action="/"> <form action="javascript:return true">
<van-search class="common_search" v-model="searchValue" v-on="$listeners" v-bind="$attrs" /> <van-search class="common_search" v-model="searchValue" v-on="$listeners" v-bind="$attrs" />
</form> </form>
</template> </template>
...@@ -13,21 +13,21 @@ export default { ...@@ -13,21 +13,21 @@ export default {
model: { model: {
prop: ['keyword'] prop: ['keyword']
}, },
data() { data () {
return { return {
searchValue: '' searchValue: ''
} }
}, },
watch: { watch: {
searchValue(val) { searchValue (val) {
this.$emit('input', val) this.$emit('input', val)
}, },
keyword(val) { keyword (val) {
this.searchValue = val this.searchValue = val
} }
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import "~@/assets/css/search.less"; @import '~@/assets/css/search.less';
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -22,9 +22,16 @@ export default { ...@@ -22,9 +22,16 @@ export default {
}, },
data () { data () {
return { return {
keyword: this.defKeyword, keyword: ''
} }
}, },
watch: {
defKeyword (val, old) {
this.keyword = val
}
},
methods: { methods: {
handleSearch (val) { handleSearch (val) {
this.$store.dispatch('search/APushHomeSearchValue', val) this.$store.dispatch('search/APushHomeSearchValue', val)
...@@ -34,6 +41,9 @@ export default { ...@@ -34,6 +41,9 @@ export default {
emitSearchValue (val) { emitSearchValue (val) {
this.$emit('search', val) this.$emit('search', val)
} }
},
mounted () {
// this.keyword = this.defKeyword
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!