解决wx-open-launch-weapp样式(无法使用vw)的问题

问题:在使用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.效果如下

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值