方法1.
樣式中加入!important,即:width: 100% !important;
wxss代碼示例
1
2
3
4
5
6
7
8
9
|
.login-btn {
font-size
:
16px
;
width
:
100%
!important
;
font-weight
:
400
;
color
:
#fff
;
border-radius:
4px
;
border
:
1px
solid
rgba(
254
,
50
,
50
,
1
);
background
:linear-gradient(
180
deg,rgba(
241
,
94
,
94
,
1
)
0%
,rgba(
222
,
62
,
62
,
1
)
100%
);
}
|
wxml代碼示例:
1
|
<
button
class="login-btn" bindclick="login">登錄</
button
>
|
效果如下圖
方法2.
標簽內,使用style
wxml代碼示例:
1
|
<
button
class="login-btn" bindclick="login" style="width:100%">登錄</
button
>
|
方法3.
刪除app.json的配置"style": "v2",不過這個不推薦