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