Survive by day and develop by night.
talk for import biz , show your perfect code,full busy,skip hardness,make a better result,wait for change,challenge Survive.
happy for hardess to solve denpendies.
目录
props功能:让组件接受外部传过来的数据
props是用于Vue中父组件向子组件传值的时候使用。
概述
vue全局和局部组件
需求:
设计思路
实现思路分析
1.URL管理
(1):传递数据:
第一种:(只接收):props: [‘name’]
第二种:(限制类型):props:{ name:Number }
第三种:(限制类型,限制必要性,指定默认值):
2.
备注:props是只读的,Vue底层会监测你对props的修改,如果进行了修改,就会发出警告,
若业务需求确实需要修改,那么请复制props的内容在data中声明一份,然后去修改data
中的数据。
3.在URL中props的传参
props值为对象,该对象中所有的key-value的组合
最终都会通过props传给Wea组件
props: {id:123456}
4.
props值为布尔值 true,则把路由收到的所有params
参数通过props传过去
参考资料和推荐阅读
[1].https://blog.youkuaiyun.com/ss15363380815/article/details/121632053https://blog.youkuaiyun.com/qq_42677001/article/details/95625920).
[2].https://www.jianshu.com/p/cf14c80189ad
欢迎阅读,各位老铁,如果对你有帮助,点个赞加个关注呗!~