摘要:
1.路由URL参数和localStorage(可忽略) 在传统开发时我们常常把需要跨页面传递的数据放到url后面,跳转到另外页面时直接获取url字符串获取想要的参数即可,在vue跨组件时一样可以这么做, // router index.js 动态路由 { path:'/params/:Id', co 阅读全文
摘要:
通过$emit 实现子组件向父组件通信 vm.$emit( event, arg ) //$emit 绑定一个自定义事件event,当这个这个语句被执行到的时候,就会将参数arg传递给父组件,父组件通过@event监听并接收参数。 //父组件 <template> <div> <h1>{{title 阅读全文
摘要:
通过prop实现通信 <!-- 父组件 --> <template> <div> <h1>我是父组件!</h1> <child message="我是子组件一!"></child> //通过自定义属性传递数据 </div> </template> <script> import Child from 阅读全文