vue 公众号开放标签跳转小程序 wx-open-launch-weapp


//在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>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM