ps:App.vue 父组件

  Hello.vue 子组件
 

App.vue  :

<template>
<div id="app">
<input type="button" name="" id="" @click="parentCall" value="父调子" />
<hello ref="chil" />//hello组件
</div>
</template> <script>
import hello from './components/Hello'
export default {
name: 'app',
'components': {
hello
},
methods: {
   parentCall () {
     this.$refs.chil.chilFn('我是父元素传过来的')
   }
}
}
</script> /*Hello.vue :*/ <template>
<div class="hello"></div>
</template> <script>
export default {
name: 'hello',
'methods': {
   chilFn (msg) {
     alert(msg)
   }
}
}
</script>

最新文章

  1. shell 1&gt;&amp;2 2&gt;&amp;1 &amp;&gt;filename重定向的含义和区别
  2. System.Web.AspNetHostingPermission 类型的权限已失败
  3. android插件中或者library中获取asstes文件
  4. [HB2014 Week5] Allot 人员分配
  5. 收集的maven 仓库地址(maven repository)
  6. Javascript 固定表格表头
  7. IE11打不开网页, 所有菜单都被禁用了。
  8. INTERPRETER(解释器)
  9. 【BZOJ】1006: [HNOI2008]神奇的国度 弦图消除完美序列问题
  10. C#小数点位数处理方法
  11. .net core 使用Redis的发布订阅
  12. 交互题[CF1103B Game with modulo、CF1019B The hat、CF896B Ithea Plays With Chtholly]
  13. Java oop(一些自己的理解,并没有展开很细)
  14. Incorrect username or password ( access token )解决
  15. H5页面分享微信自定义分享title和img
  16. 4. easyui删除功能实例
  17. oracle 锁表查看与解锁
  18. [转]Redis几个认识误区
  19. eclipse lua
  20. MVC ViewData与ViewBag的区别

热门文章

  1. 安装Windows和Ubuntu双系统
  2. golang实现无限级菜单(beego框架下)
  3. win7和Ubuntu16.04之间相互远程控制
  4. 微信开发核心AccessToken实现
  5. LeetCode 442. 数组中重复的数据(Find All Duplicates in an Array) 17
  6. redis 主从 哨兵
  7. Redis--list类型操作命令
  8. Scratch编程:画多边形(八)
  9. 交流绕组 &amp; 感应电机
  10. 快速批量删除 docker 镜像或容器