父组件代码
<template>
<div>
//子组件
<item1 :test="test[0]"></item1>
</div>
</template>
<script>
export default {
data(){
return {
test: ['test']
},
//或者通过手动来改
methods:{
//control(){
// 这样传不过去给子组件
//this.test[0] = 123
//生效,这样可以
//this.$set(this.test,0,‘123’)
}
}
}
</script>
子组件代码
<template>
<div>
{{test}}
</div>
</template>
<script>
export default {
props: {
//test: String,
},
}
</script>