vue动态修改css样式
<span :style="{backgroundColor:colorHex}">测试文字</span>
<button @click="changeColor">更改颜色</button>
export default{data(){return{colorHex:"#eeeeee",}},methods:{changeColor(){this.colorHex="#000";},}
}
<span :style="{backgroundColor:colorHex}">测试文字</span>
<button @click="changeColor">更改颜色</button>
export default{data(){return{colorHex:"#eeeeee",}},methods:{changeColor(){this.colorHex="#000";},}
}