vue 动态样式

三元运算符判断
555
动态设置class

{{machineItem.name}}

方法判断

{{machineItem.name}}

methods:{ machineStatusStyle(e){ console.log('值',e) if(e === 1){ return { width:'14px',height:'16px', background:"url('/src/images/time.png') no-repeat center", marginLeft: '10px' } }else if(e === 2){ return { width:'14px',height:'16px', background:"url('/src/images/time.png') no-repeat center", marginLeft: '10px' } }else if(e === 3){ return { width:'14px',height:'16px', background:"url('/src/images/time.png') no-repeat center", marginLeft: '10px' } }; } }

  

转载于:https://www.cnblogs.com/web-zqk/p/10776797.html

你可能感兴趣的:(vue 动态样式)