antd vue里面 a-table再次封装,slot-scope如何跨组件传递?

2025-05-07 17:37:02
推荐回答(2个)
回答1:

vue-bus 可以实现

 //安装: npm install vue-bus
//在main.js 中引入vuebus:
 import Vue from 'vue';import VueBus from 'vue-bus'; Vue.use(VueBus);   
 
//在组件中使用 
//触发事件:
this.$bus.emit("onslected",params)
//应对事件:
mounted:function(){
this.$bus.on("onslected",function(){

});
},
destroyed:function(){
this.$bus.off("onslected");
}

 请采纳

回答2:

同问,解决了吗?怎么传