在uniapp中绑定动态样式 :style="xxx" 样式无法生效
解决方法:使用 :style="[xxx]" ,多加一对[ ]样式生效
案例:
<view :style="[style]">
...
</view>
computed: {
style() {
return {
color: "#f4f4f6",
background: "#a0a0a0"
},
}
}
在uniapp中绑定动态样式 :style="xxx" 样式无法生效
解决方法:使用 :style="[xxx]" ,多加一对[ ]样式生效
案例:
<view :style="[style]">
...
</view>
computed: {
style() {
return {
color: "#f4f4f6",
background: "#a0a0a0"
},
}
}