vue中监听数据变化 watch

130 阅读1分钟
父组件
   <div>
       <small-topic :subjectTypeValue="searchForm.subjectType"></small-topic>
   </div>
   
   import smallTopic from "./smallTopic"  
   
   components:{
      smallTopic
   }
   
   searchForm:{
      subjectType:'11111'
   },
子组件

接收值
props:{
    subjectTypeValue: {
      type: String,
      default: ''
    },
  },
  
  watch: {
      subjectTypeValue:'getBigTopic'  //值可以为methods的方法名
  },
  
  methods:{
     this.getBigTopic() 
  }

www.cnblogs.com/ilovexiaomi…