uniapp中父组件向子组件传递prop时,如果prop是对象,对象内部不能包含function属性
例子如下
father.vue
<template>
<view class="uni-container">
<child :fatherData="fatherData" :fatherFcuntion="fatherFcuntion" :fatherMethod="fatherMethod"></child>
</view>
</template>
<script>
import child from './child.vue'
export default {
components: {
child
},
data() {
return {
fatherData: {
a: 1,
b: {
isShow: function() {
console.log("data定义对象属性函数");
}
}
},
fatherFcuntion: function() {
console.log("data定义函数变量");
},
}
},
methods: {
fatherMethod() {
console.log("method的定义函数");
},
}
}
</script>
child.vue
<template>
<view>
child
</view>
</template>
<script