新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

vuejs中父子组件之间通信方法实例详解

本文实例讲述了vuejs中父子组件之间通信方法。分享给大家供大家参考,具体如下:

成都创新互联公司主营马关网站建设的网络公司,主营网站建设方案,app软件开发,马关h5成都小程序开发搭建,马关网站营销推广欢迎马关等地区企业咨询

一、父组件向子组件传递消息

// Parent.vue




// Child.vue



// router/index.js

import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Parent from '@/test/Parent'
Vue.use(Router)
export default new Router({
 routes: [
  {
   path: '/',
   name: 'HelloWorld',
   component: HelloWorld
  },
  {
   path: '/parent',
   component: Parent
  }
 ]
})

二、子组件向父组件传递消息

// Parent.vue




// Child.vue




参考:https://jingyan.baidu.com/article/455a99505b639da1662778e1.html

希望本文所述对大家vue.js程序设计有所帮助。


本文标题:vuejs中父子组件之间通信方法实例详解
本文URL:http://www.wjwzjz.com/article/gpcsps.html
在线咨询
服务热线
服务热线:028-86922220
TOP