问题:在使用wx-open-launch-weapp时,往往需要对按钮进行适配,如果给按钮设置vw单位会导致其不生效
解决方案:
1.给wx-open-launch-weapp添加style
<wx-open-launch-weapp id="launch-btn" appid="wx5c4513ae6e503ad7" username="gh_7a3f39727a80" :path="path" style=" width: 100%;display: -webkit-inline-box;" @launch="sucFun" @error="errFun" >
2.给按钮设置vw,并添加!important;
<wx-open-launch-weapp
id="launch-btn"
appid="wx5c4513ae6e503ad7"
username="gh_7a3f39727a80"
:path="path"
style=" width: 100%;display: -webkit-inline-box;"
@launch="sucFun"
@error="errFun"
>
<script type="text/wxtag-template">
<style>.guideBtn{
width: 100% !important;
height: 8vw !important;
color: #fff;
padding-top:50% !important;
font-size: 8vw !important;
text-align: center;
}</style>
<div class="guideBtn">优惠支付</div>
</script>
</wx-open-launch-weapp>
3.效果如下