css dynamic inline style implementation

场景:不同值显示的字体颜色不同
It is necessary to dynamically modify the font color, the sample code is as follows:

<view :style="{ color: statusColor, 'margin-top': 40 + '%;margin-left: 8px;' }">
	{
    
    {
    
    approveCard.status}}
</view>
data() {
    
    
	return {
    
    
		statusColor: this.approveCard.statusColor,
		status: this.approveCard.status,
	};
},

The effect is as follows:
insert image description here

Guess you like

Origin blog.csdn.net/Shiny_boy_/article/details/129689162