前端基础
前端框架
前端相关
开发方式
开发框架
数据库
服务运维
学习
熏陶
考研
计算机
阅读剪裁
Appearance
API
子组件通过$emit派发事件和值给父组件(值可以有多个)
$emit
this.$emit('fnX', value)
父组件通过v-on绑定子组件派发的事件,并触发一个新的事件,新的事件内可以接收传来的值
v-on
<ComponentName @fnX="fnY"></ComponentName> methods: { fnY(value) { console.log(value) } }
See the Pen mdJVqgg by aths (@aths) on CodePen.