uniapp :style=“xxx“动态绑定样式踩坑

在uniapp中绑定动态样式 :style="xxx" 样式无法生效

解决方法:使用 :style="[xxx]" ,多加一对[ ]样式生效

案例:

<view :style="[style]">
                   ...
</view>



computed: {
			style() {
				
					return {
						color: "#f4f4f6",
						background: "#a0a0a0"
					},
			}
}

				

猜你喜欢

转载自blog.csdn.net/qq_54994255/article/details/142251580