当前位置: 首页 > news >正文

山东省建设机械协会网站wordpress 主题哪里买

山东省建设机械协会网站,wordpress 主题哪里买,硬盘做网站空间,wordpress数据库使用全局事件总线(GlobalEventBus) 一种可以在任意组件通信的方式#xff0c;本质上就是一个对象#xff0c;它必须满足以下条件 所有的组件对象都必须能看见他这个对象必须能够使用$ on $ emit $ off方法取绑定、触发和解绑事件 使用步骤 定义全局事件总线 //创建VUE new V…全局事件总线(GlobalEventBus) 一种可以在任意组件通信的方式本质上就是一个对象它必须满足以下条件 所有的组件对象都必须能看见他这个对象必须能够使用$ on $ emit $ off方法取绑定、触发和解绑事件 使用步骤 定义全局事件总线 //创建VUE new Vue({el:#app,render:h h(App),beforeCreate(){Vue.prototype.$busthis //安装全局事件总线},})使用事件总线 a.接收数据A组件想接收数据则在A组件中给$bus 绑定自定义事件事件的回调留在A组件自身 export default{methods(){demo(data){...}}...mounted(){this.$bus.$on(xxx,this.demo)} }b.提供数据this.$bus.$emit(xxx,data) 3. 最好在beforeDestroy钩子中用**$off()**去解绑当前组件所用到的事件。 src/main.js //引入vue import Vue from vue //引入APP.vue import App from ./App.vue//关闭Vue的生产提示 Vue.config.productionTipfalse//创建VUE new Vue({el:#app,render:h h(App),beforeCreate(){Vue.prototype.$busthis //安装全局事件总线},}) src/App.vue templatediv classapph1{{msg}}/h1School/SchoolStudent/Student/div /templatescriptimport Student from ./components/Studentimport School from ./components/Schoolexport default {name:App,components:{School,Student},data() {return {msg:你好啊}}} /scriptstyle scoped.app{background-color: gray;padding: 5px;} /style src/compoents/School.vue templatediv classschoolh2学校名称{{name}}/h2h2学校地址{{address}}/h2/div /templatescriptexport default {name:School,data() {return {name:尚硅谷,address:北京,}},mounted() {// console.log(School,this)this.$bus.$on(hello,(data){console.log(我是School组件收到了数据,data)})},beforeDestroy() {this.$bus.$off(hello)},} /scriptstyle scoped.school{background-color: skyblue;padding: 5px;} /stylesrc/compoents/Student.vue templatediv classstudenth2学生姓名{{name}}/h2h2学生性别{{sex}}/h2button clicksendStudentName把学生名给School组件/button/div /templatescriptexport default {name:Student,data() {return {name:张三,sex:男}},mounted() {// console.log(Student,this.x)},methods: {sendStudentName(){this.$bus.$emit(hello,this.name)}},} /scriptstyle scoped.student{background-color: pink;padding: 5px;margin-top: 30px;} /style
http://www.hkea.cn/news/14593597/

相关文章:

  • 公司网站制作公有个新网站能提供
  • 中国住房建设部网站首页上海做网站就用乐云seo
  • 网站排名要怎么做国际域名网站
  • 用wordpress开发网站模板黑龙江建设局网站
  • 民权网站建设南山出名的互联网公司
  • 公司网站的开发秦皇岛百度推广
  • 网站开发融资网站改版后不收录
  • 网站上的二维码怎么做的ui设计师与前端开发怎么对接
  • 深圳制作网站专业wordpress 命令行
  • 网站建设代理商电话深圳富通做网站
  • 湖南建设网站the 7 wordpress theme
  • 免费制作微信小程序的网站wordpress 媒体库加载不了图片
  • 建设旅游网站深圳高端网站设计建设
  • 做化学合成的网站有哪些西安手机定制网站建设
  • 如何将网站的关键词排名优化中兴能源建设有限公司网站
  • 郑州快速建站价格公司网站内容相近
  • 广州黄埔做网站的公司哪家好2018年网站设计公司
  • 宝安中心客运站网站 筛选功能
  • 交互做的好的网站三门峡网站建设价格
  • 娄底网站建设wyo8研发一个app费用
  • 网站设计计费郑州建设工程信息网站
  • 莱芜网站seowordpress know how
  • 网站建设合同样本响应式布局的优点是什么
  • 长沙经开区建设局网站漳州专业网站建设公司
  • 番禺 大石网站建设互联网广告代理加盟
  • 网站建设 中企动力 石家庄个体户怎么做购物网站
  • 郑州网站建设 华数网站建设注册什么公司好
  • 毕设做网站和app留言板网页模板
  • 上海网站开发哪家好薇wordpress例
  • 网站里面的视频功能怎么做上海金山区建设局网站