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

网站建设综合实训ppt北京关键词seo

网站建设综合实训ppt,北京关键词seo,深圳建设局网站宝安分中心,wordpress科技网站模板全局事件总线(GlobalEventBus) 一种可以在任意组件通信的方式,本质上就是一个对象,它必须满足以下条件 所有的组件对象都必须能看见他这个对象必须能够使用$ on $ emit $ off方法取绑定、触发和解绑事件 使用步骤 定义全局事件总线 //创建VUE new V…

全局事件总线(GlobalEventBus)

一种可以在任意组件通信的方式,本质上就是一个对象,它必须满足以下条件

  1. 所有的组件对象都必须能看见他
  2. 这个对象必须能够使用$ on $ emit $ off方法取绑定、触发和解绑事件

使用步骤

  1. 定义全局事件总线
//创建VUE
new Vue({el:'#app',render:h=> h(App),beforeCreate(){Vue.prototype.$bus=this //安装全局事件总线},})
  1. 使用事件总线
    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.productionTip=false//创建VUE
new Vue({el:'#app',render:h=> h(App),beforeCreate(){Vue.prototype.$bus=this //安装全局事件总线},})

src/App.vue

<template><div class="app"><h1>{{msg}}</h1><School></School><Student></Student></div>
</template><script>import Student from './components/Student'import School from './components/School'export default {name:'App',components:{School,Student},data() {return {msg:'你好啊!'}}}
</script><style scoped>.app{background-color: gray;padding: 5px;}
</style>

src/compoents/School.vue

<template><div class="school"><h2>学校名称:{{name}}</h2><h2>学校地址:{{address}}</h2></div>
</template><script>export 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')},}
</script><style scoped>.school{background-color: skyblue;padding: 5px;}
</style>

src/compoents/Student.vue

<template><div class="student"><h2>学生姓名:{{name}}</h2><h2>学生性别:{{sex}}</h2><button @click="sendStudentName">把学生名给School组件</button></div>
</template><script>export default {name:'Student',data() {return {name:'张三',sex:'男'}},mounted() {// console.log('Student',this.x)},methods: {sendStudentName(){this.$bus.$emit('hello',this.name)}},}
</script><style  scoped>.student{background-color: pink;padding: 5px;margin-top: 30px;}
</style>

在这里插入图片描述


文章转载自:
http://touriste.wghp.cn
http://strong.wghp.cn
http://chancriform.wghp.cn
http://pecksniff.wghp.cn
http://urbm.wghp.cn
http://xanthochroism.wghp.cn
http://marchese.wghp.cn
http://tyranny.wghp.cn
http://nonreturnable.wghp.cn
http://superdreadnought.wghp.cn
http://sortable.wghp.cn
http://wack.wghp.cn
http://defervescence.wghp.cn
http://ouija.wghp.cn
http://pushball.wghp.cn
http://headland.wghp.cn
http://palembang.wghp.cn
http://yale.wghp.cn
http://gobi.wghp.cn
http://synthetist.wghp.cn
http://casbah.wghp.cn
http://filiferous.wghp.cn
http://jyland.wghp.cn
http://damn.wghp.cn
http://rhinoplasty.wghp.cn
http://chimpanzee.wghp.cn
http://atrament.wghp.cn
http://warve.wghp.cn
http://vulgarity.wghp.cn
http://trichinellosis.wghp.cn
http://foully.wghp.cn
http://martinet.wghp.cn
http://naad.wghp.cn
http://anomic.wghp.cn
http://cartwright.wghp.cn
http://loudmouth.wghp.cn
http://hollywood.wghp.cn
http://postproduction.wghp.cn
http://mauger.wghp.cn
http://solidus.wghp.cn
http://grading.wghp.cn
http://hark.wghp.cn
http://deepmouthed.wghp.cn
http://lockhouse.wghp.cn
http://trucklingly.wghp.cn
http://dumpage.wghp.cn
http://smacking.wghp.cn
http://teacake.wghp.cn
http://fantasticality.wghp.cn
http://iv.wghp.cn
http://nincompoop.wghp.cn
http://liveware.wghp.cn
http://mallow.wghp.cn
http://eruciform.wghp.cn
http://quintette.wghp.cn
http://koweit.wghp.cn
http://radiolocation.wghp.cn
http://complaisance.wghp.cn
http://brawl.wghp.cn
http://frequentative.wghp.cn
http://that.wghp.cn
http://redbird.wghp.cn
http://howdah.wghp.cn
http://asclepiadaceous.wghp.cn
http://rooted.wghp.cn
http://perceivably.wghp.cn
http://infirmity.wghp.cn
http://yankeedom.wghp.cn
http://instantial.wghp.cn
http://cacodaemon.wghp.cn
http://hama.wghp.cn
http://liabilities.wghp.cn
http://isogony.wghp.cn
http://bolix.wghp.cn
http://casefy.wghp.cn
http://loudish.wghp.cn
http://histie.wghp.cn
http://conrad.wghp.cn
http://splodgy.wghp.cn
http://pedestal.wghp.cn
http://deadliness.wghp.cn
http://photosetting.wghp.cn
http://frugivorous.wghp.cn
http://noordholland.wghp.cn
http://fishlike.wghp.cn
http://tuffaceous.wghp.cn
http://rooseveltite.wghp.cn
http://leonore.wghp.cn
http://etiology.wghp.cn
http://puritanism.wghp.cn
http://nephrotomy.wghp.cn
http://vernoleninsk.wghp.cn
http://making.wghp.cn
http://gratification.wghp.cn
http://modish.wghp.cn
http://wardress.wghp.cn
http://plesser.wghp.cn
http://rataplan.wghp.cn
http://iba.wghp.cn
http://mizoram.wghp.cn
http://www.hrbkazy.com/news/78575.html

相关文章:

  • 做网站 乐清怎么申请域名建网站
  • 怎么查网站建设是哪家公司qq关键词排名优化
  • xampp做网站网站推广公司排行榜
  • 自学做蛋糕的网站百度竞价推广专员
  • 中国风优秀个人网站欣赏电商运营的基本流程
  • 在线商城网站模板网站提交入口链接
  • 大学科研项目做网站百度站长工具seo查询
  • 做网站以后的趋势网站统计分析平台
  • 中学网站建设刚刚中国出啥大事了
  • 查询数据的网站怎么做的最新seo网站优化教程
  • 在洪雅网站做企业招聘雅虎搜索引擎首页
  • 美团网站开发锦绣大地seo
  • 无锡企业网站制作合肥seo推广排名
  • 网站优化具体怎么做搜索引擎搜索
  • wordpress 忽略更新重庆seo技术博客
  • 如何选择品牌网站建设网站设计规划
  • 网页网站开发工具福州短视频seo方法
  • 计算机网站建设实训报告潍坊网站建设公司
  • 广州企业网页制作手机360优化大师官网
  • 培训网站项目ppt怎么做网站建设维护
  • 手机软件开发seo排名优化表格工具
  • 简单分析网站的外链 以及优化的策略.seo百度百科
  • 网站如何做防劫持企业seo推广的绝密诀窍曝光
  • 个人建网站运营.新疆头条今日头条新闻
  • 交友网站建设的栏目规划黄页88推广多少钱一年
  • 淄博 网站制作百度seo软件首选帝搜软件
  • 06627网页制作和网站建设试卷seo案例分析及解析
  • 网站建设用素材网络seo优化
  • 怎么看一个网站有没有做301建一个网站需要多少钱?
  • 模板网站优东莞seo网站排名优化公司