父组件
<sbind-data v-model="keywords" />
子组件:
<template>
<div>
{{ childValue }}
<el-input v-model="childValue" @input="change" />
</div>
</template>
<script>
export default {
name: 'Index',
props: {
value: {
type: [String, Array],
default: () => {},
},
},
data() {
return {
childValue: '',
}
},
watch: {
value(newValue, oldValue) {
console.log(oldValue)
this.childValue = newValue
},
},
mounted() {
this.childValue = this.value
},
created() {},
methods: {
change() {
this.$emit('input', this.childValue)
},
},
}
</script>
<style scoped></style>