父组件调用子组件的方法:
this.$refs.child.clickme();
注意:用ts这样写是会报错的,所以ts写法如下
(this.$refs.approval as any).openDialog()
子组件调用父组件的方法:
this.$emit('wzhclick', {a:1,b:2}); 两平等组件间的调用:
var Event = new Vue();//事件调度器 Event.$emit("wzhsay", this.msg); mounted: function () { var me = this; Event.$on("wzhsay", function (data) { me.wzhmsg = data; }); } });