1. 父组件给子组件传值:
vue中父组件给子组件传值使用的是props;
1.首先在我的父组件中引入我的子组件:
![9898993-79816b01ded1a212.png](https://upload-images.jianshu.io/upload_images/9898993-79816b01ded1a212.png)
然后将组件挂载注册,在template中引用:
![9898993-5570659fce35f204.png](https://upload-images.jianshu.io/upload_images/9898993-5570659fce35f204.png)
在我的子组件中使用props:
![9898993-b6de9303a348a9c8.png](https://upload-images.jianshu.io/upload_images/9898993-b6de9303a348a9c8.png)
2. 子组件给父组件传值:子组件传值给父组件利用事件绑定:在我的父组件中:
![9898993-0fe08d17c6d1cb97.png](https://upload-images.jianshu.io/upload_images/9898993-0fe08d17c6d1cb97.png)
![9898993-7f132ab19228cafa.png](https://upload-images.jianshu.io/upload_images/9898993-7f132ab19228cafa.png)
1. 父组件给子组件传值:
vue中父组件给子组件传值使用的是props;
1.首先在我的父组件中引入我的子组件:
然后将组件挂载注册,在template中引用:
在我的子组件中使用props:
2. 子组件给父组件传值:子组件传值给父组件利用事件绑定:在我的父组件中: