我的具体代码实现:
页面中
<view class="content">
<waller-components :blanceMoney="blanceMoney" ref="wallerComponents" @clickButton="clickButton"></waller-components>
</view>
import wallerComponents from "../../components/wallerComponents/wallerComponents.vue";
export default {
components:{
'waller-components':wallerComponents
},
data() {
return {
blanceMoney:1200
}
},
子组件中接收值:
props:{
balanceMoney: {
type:Number,
default:100
}
},
最后的问题就是balanceMoney这个值始终都是默认值显示100,不会显示页面绑定传过来的1200. 这个我看在uni-app的模板例子里面是可以实现的。 我就不知道我是哪里写错了还是怎么了,实在找不到问题的错误点了, 希望有知道的小伙伴给点提示和意见
1 个回复
5***@qq.com (作者) - 掉坑里了
解决了,是我自己把blanceMoney,在子组件props中写成了balanceMoney。