理论是vue3需要显示配置需要被忽略的标签,但实际测试下来,就算注释之,也可以正常使用.
忽略标签方法说明 全局 API | Vue.js
const vueIns = Vue.createApp({})
vueIns.config.compilerOptions.isCustomElement = tag => tag.startsWith('wx-open-launch-weapp')
在.vue文件中,按下方格式编写,关键点就是vue3要用v-is
<wx-open-launch-weapp id="launch-btn" username="gh_25e071b83ee0" path="pages/watch/index?living_code=LIVING_CODE" >
<div v-is="'script'" type="text/wxtag-template">
<div v-is="'style'">
.openbtn{background-color:#38f;color:#fff;width:100px;height:40px;line-height:40px;}
</div>
<div class="openbtn">跳转小程序</div>
</div>
</wx-open-launch-weapp>
当然不能忘了载入wx JS-SDK申请权限
<script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js" type="text/javascript"></script>