爬坑记录--微信样式升级

199 阅读1分钟

遇到的问题

在今天的开发中遇到了无法修改button宽度的问题,而且button的样式设置了hetght和line-height相等也无法实现文字垂直居中

.btn {
    font-weight: 300;
    background-color: #d8d8d8;
    color: #ffffff;
    height: 25px;
    width: 80px;
    line-height: 25px;
    font-size: 12px;
    border-radius: 15px;
    margin: 0px 10px;
}

解决

经过查找资料发现原因是微信进行了基础组件的样式升级,在app.json中默认增加了一项“style“: “v2“,删除后恢复正常。官方链接