The width setting of the button in the cover-view of the WeChat applet is invalid

I originally set it like this, but it couldn't be displayed normally on the mobile phone. After debugging on the real machine, I adjusted the style.

<cover-view class="btns">
	<button class="btn" bindtap="addCartSureBtn">确定</button>
	<button class="btn" bindtap="hideModel">取消</button>
</cover-view>
.btns .btn {
    
    
  width: 190rpx !important;//设置最高级也无效
}

Modify as follows:

.btns .btn {
    
    
  width: 190rpx;
}

.btns .wx-button-cover-view-inner,
.btns .wx-button-cover-view-wrapper {
    
    
  width: 100%;
  padding: 0;
}
.wx-button-cover-view-inner and .wx-button-cover-view-wrapper are the class names automatically added by the button under the cover-view tag

Guess you like

Origin blog.csdn.net/cengjing123_/article/details/108730878