在app端内嵌页面中调用vue中的函数。

在app端内嵌页面中调用vue中的函数时,拿不到methods中定义的函数,需要将Vue项目methods中的方法在mounted中暴露在window上


mounted() {
  window["shareInfo"] = () => {
        this.shareInfo();
   };
}
 
methods: {
    shareInfo() {
  console.log('11')
    },
}
posted @ 2021-01-05 14:19  张小中  阅读(1535)  评论(0编辑  收藏  举报