Vue组件的通信
1.父子组件的通信
传递参数可以使用props,传递函数可以直接在调用子组件的时候传递自定义事件,并使用$emit来调用,例如:
1 | //父组件 |
2.兄弟组件通信
首先建立一个vue实例空白页(js文件)
1 | import Vue from 'vue' |
组件a(数据发送方)通过使用 $emit 自定义事件把数据带过去
1 |
|
组件b(数据接收方)使用而通过 $on监听自定义事件的callback接收数据
1 | <template> |
天晴了,雨停了,我又觉得我行了....
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent: meta: false pages: false posts: title: true date: true path: true text: false raw: false content: false slug: false updated: false comments: false link: false permalink: false excerpt: false categories: false tags: true