javascript - After the VUE parent component model changes, why do the props passed into the child component not change?
習慣沉默
習慣沉默 2017-05-19 10:30:47
0
2
596

After the VUE parent component model is changed, why do the props passed to the child component not change?

Parent component

  

Subassembly

  

After I click the test method, I change the banner of the parent component. Why does the model of the subcomponent not change after the banner is passed into the subcomponent?

習慣沉默
習慣沉默

reply all (2)
Peter_Zhu

Because your template uses the data in data instead of props. You only assign values to data during initialization. If you need to change data when props changes, you need to add a watch. But in your case Just use props directly.

    滿天的星座

    The data sent from the parent component can be used directly after receiving it with props. There is no need to declare a data again to receive it

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!