Home  >  Article  >  WeChat Applet  >  What should I do if the button width setting in the WeChat applet is invalid?

What should I do if the button width setting in the WeChat applet is invalid?

王林
王林forward
2021-03-12 10:05:223953browse

What should I do if the button width setting in the WeChat applet is invalid?

Preface:

I don’t know if you have ever encountered such a problem. Setting the width of the button button in the applet has no effect. If you often encounter this problem, then take a look at the solutions below.

Method 1: (Recommended) Write inline styles directly on the button button

wxml code example:

  <button type="primary" style="width:100%">按钮</button>

What should I do if the button width setting in the WeChat applet is invalid?

Method 2: Delete the configuration "style": "v2" in app.json

After configuring "style": "v2" in app.json, you can enable the new version of the component style. Emmm, it exists for a reason. It's okay. We won’t touch it anymore and recommend you to use method one.

(Learning video sharing: php video tutorial)

wxml code example:

<button type="primary">按钮</button>

wxss code example

button{
  width: 100%;
}

What should I do if the button width setting in the WeChat applet is invalid?

Related recommendations: 小program development tutorial

The above is the detailed content of What should I do if the button width setting in the WeChat applet is invalid?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete