//在main.js里添加代碼 Vue.config.ignoredElements = ['wx-open-launch-weapp'];
//index.html jssdk版本1.6.0以上才可以 !! important <script src='//res.wx.qq.com/open/js/jweixin-1.6.0.js'></script>
<template> <div> <wx-open-launch-weapp id="launch-btn" username="gh_747fd668e2a6" path="pages/core/web?url=https://phar.linkdoc.com/open/redirect/immunity_online?openid=oRI_g1VF_xNOUm095jMmJvGkWKDw&scanid=01f485d5-7edf-4279-a089-1df1fb3849ba&pagePath=%2Fsubpkg_order%2Fpages%2FreservationOrder%2Findex%3FprojectQrCode%253D4"> <script type="text/wxtag-template"> <style>.btn { padding: 12px}</style> <button class="btn">跳轉小程序</button> </script> </wx-open-launch-weapp> </div> </template> <script> import { mapState, mapMutations, mapActions } from "vuex"; export default { data() { return {} }, created() { this.getWxConfig(location.href); }, mounted() { this.$store.state.showMenu = false var btn = document.getElementById('launch-btn'); btn.addEventListener('launch', function (e) { console.log('success'); }); btn.addEventListener('error', function (e) { console.log('fail', e.detail); }); }, methods: { ...mapActions({ getWxConfig: "getWxConfig" }) } } </script>