uni-app <template>模板中调用主页的方法

模板页  list-tel-card.vue

<uni-td align="center">
       <view class="uni-group">
            <button class="uni-button" size="mini" @click="showMsgList(item.tel)">外呼</button>
       </view>
</uni-td>

其中  showMsgEvent  主页的方法名  msg 为参数

methods: {
    showMsgList(msg){
      this.$emit('showMsgEvent', msg);
  },

}

 

主页

<view v-else-if="seen==2">
    <list-tel-card :tableData="tableDataList2"  @showMsgEvent="showMsg">></list-tel-card> 
</view> 

 

methods: {
   showMsg(msg){                
         alert(msg);
   },
}

 

posted @   海乐学习  阅读(294)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2021-01-13 vue中的全局变量 this.$store.state 的取值与赋值
点击右上角即可分享
微信分享提示