<wx-open-launch-weapp path="pages/card/visit_card.html?id=19" id="launch-wxapp" username="gh_abc199886dfa">
<script type="text/wxtag-template">
<style>
.btn-open-weapp{
background: linear-gradient(to right, #ffd52e 0%, #ffef93 50%, #ffd52e 100%);
border: 0;
color: #424242;
text-shadow: 0px 1px 1px #fff;
border-radius: 50px;
text-align: center;
width: 120px;
height: 35px;
line-height: 35px;
outline:none;
}
</style>
<button class="btn-open-weapp">进店逛逛</button >
<script>
</wx-open-launch-weapp>`
原来直接这样子用,发现有问题,安卓端正常,但苹果端首次进入H5页面显示不了按钮,只有刷新才能显示,于是折腾一翻,因为H5端支持v-html,测试了下一切正常
下面这种方式,微信开发者工具也能看到按钮哦
<!-- #ifdef H5 -->
<view v-html="wxOpenTags"></view>
<!-- #endif -->
//#ifdef H5
setTimeout(()=>{
this.wxOpenTags=`<wx-open-launch-weapp path="pages/card/visit_card.html?id=19" id="launch-wxapp" username="gh_abc199886dfa">
<template>
<style>
.btn-open-weapp{
background: linear-gradient(to right, #ffd52e 0%, #ffef93 50%, #ffd52e 100%);
border: 0;
color: #424242;
text-shadow: 0px 1px 1px #fff;
border-radius: 50px;
text-align: center;
width: 120px;
height: 35px;
line-height: 35px;
outline:none;
}
</style>
<button class="btn-open-weapp">进店逛逛</button >
</template>
</wx-open-launch-weapp>`;
},1000);
//#endif
wx-open-launch-app也用v-html的方式
25 个评论
要回复文章请先登录或注册
1***@qq.com
newDate
1***@qq.com
1***@qq.com
1***@qq.com
1***@qq.com
1***@qq.com
1***@qq.com
j***@live.cn
aliang888 (作者)