新版微信小程序的 app.json 文件中多了一個(gè):style": "v2"
{
"pages":[
"pages/index/index",
"pages/logs/logs"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle":"black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}

fcfaaf51f3deb48f8b49efa3e01f3a292df578ae.png
可以看做是微信小程序基礎(chǔ)組件樣式升級(jí),使用v2版本的組件樣式默認(rèn)情況和v1不同,涉及的組件有6個(gè)。
例如 button:
<button type="primary">提交</button>
<button type="primary" loading="true">Loading</button>
<button type="primary" disabled="true">Disabled</button>
V2版效果如圖:

QQ截圖20230510110619.png
如果把 "style": "v2", 刪除,
{
"pages":[
"pages/index/index",
"pages/logs/logs"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle":"black"
},
"sitemapLocation": "sitemap.json"
}
效果如圖:

QQ截圖20230510110648.png
還有其他組件的區(qū)別,就不一一列舉了。
注意:
當(dāng)使用微信小程序進(jìn)行開(kāi)發(fā)時(shí),如果使用vant組件庫(kù)或其他組件,刪除 app.json 里面的 "style": "v2" 時(shí),會(huì)導(dǎo)致有的頁(yè)面部分樣式失效。這時(shí)候可以把有問(wèn)題的 .json 后綴的文件里添加上"style": v2就可以了。比如你需要在 user 頁(yè)面里使用微信提供的默認(rèn)樣式,就在 user.json 里面寫(xiě)上 “style”: “v2”就可以了。