Vue2.0 parent component method for transmitting data to child components

Reference submissions A.VUE in the parent component app.Vue, pass the value of the NAME to the A component.

Newly built a folder in the desktop

  $ cd to file $ npm install -g Vue-CLI $ Vue Init Webpack. $ NPM Install $ NPM RUN DEV  
Vue Init Webpack. After the selection

vue2.0 父组件给子组件传递数据的方法

1. Remove some of the contents in the app as follows

2. Delete HelloWorld.Vue in the Components file

3, modification vue2.0 父组件给子组件传递数据的方法

Modified App.Vue is as follows:

// Message Defines in PROPS in subcomponents
  Import a from './components/a'Export default {name:' app ', components : {A}, data () {return {name: "I am data"}}}      4, new  
New A.VUE in Components is written as follows:

{{mEssage}}

EXPORT DEFAULT {Props: [‘Message’] // Accept the data transferred by Message}
   
5, last

 Summary   
The above is a method of passing the Vue2.0 parent component to the sub-component to pass the data. I hope to help everyone. If you have any questions, please leave a message, Xiaobian will reply to everyone in time. Thank you very much for your support of Tumi Cloud Website!
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment