父组件(页面)
<template>
<view>
<form>
<view class="cu-form-group margin-top">
<view class="title">父组件</view>
<input v-model="item.val" placeholder="值"></input>
</view>
<qn-item :item="item" />
</form>
</view>
</template>
<script>
export default {
data() {
return {
item: {
id: 'name',
title: '姓名',
val: ''
}
}
},
methods: {
}
}
</script>
子组件 qn-item
<template>
<view class="cu-form-group margin-top">
<view class="title">子组件</view>
<input v-model="item.val" placeholder="值"></input>
</view>
</template>
<script>
export default {
components: {},
props: {
item: {
type: Object,
default: () => {
return {}
}
}
},
data () {
return {
}
},
computed: {},
watch: {
},
created () {},
mounted () {},
methods: {
}
}
</script>
1 个回复
语冰鹅 - 70后IT男
请问最后是怎么解决的?我也遇到了这样的问题