uniapp的子组件component中如何监听属性数据变化?
网友回复
子组件中增加一个watch方法
watch: { 参数属性名: { handler(newValue, oldValue) { 父组件改变参数会在这里通知,newValue就是改变后的新值 }, deep: true // 深度监听父组件传过来对象变化 } },
父组件
<template> <view> <cylindrical :haveTask="totals"></cylindrical> </view> </template> <script> import cylindrical from '@/pagesB/componentsB/cylindrical.vue' export default { components: { cyli...
点击查看剩余70%