search

Home  >  Q&A  >  body text

javascript - vue parent-child component passes data

The parent component passes an array to the child component. This data needs to be called in the child component. How to pass it?

1. The child component uses props to receive the data of the parent component and cannot be used in js.
2. Use the wacth method to monitor and not execute it at all.

Please answer from the master. Thank you!

高洛峰高洛峰2708 days ago1001

reply all(4)I'll reply

  • 高洛峰

    高洛峰2017-06-26 10:59:44

    Props cannot be used in js? How do you use it

    reply
    0
  • 扔个三星炸死你

    扔个三星炸死你2017-06-26 10:59:44

    Post the code and see how you use it?

    reply
    0
  • 代言

    代言2017-06-26 10:59:44

    You should be talking about the child component modifying the data passed by the parent component.

    vue2 now has a one-way data flow, and child components are not allowed to modify the data of the parent component. Please see the documentation for details.
    Link: https://cn.vuejs.org/v2/guide... After clicking the link, search for One-way data flow
    The document also has detailed instructions on how to handle the situation when a child component wants to operate the data of the parent component.

    reply
    0
  • PHP中文网

    PHP中文网2017-06-26 10:59:44

    On vueX

    reply
    0
  • Cancelreply