Vue 绑定css和class :style :

:style="{ 'color' : item. num == 2 ? '#000' : '#fff'}"
:style="{ 'color' : myColor}"

:class="['box', item.type== '已完成' ?'box1': item.type== '未完成? 'box2' : 'box3']"
:class=" [item.type== '已完成 ? ' box1 ':' box2']" >

www(type) {
 switch (type) {
	case type == "true":
		return color: red';
	case type == "false"
		return"color:#575757" ;
	break ;
 },
}


handlewidth(text, index, type, childrenData) {
	let borderstyle = "1px solid #ff" ;
	let width = text.length * 14;
	if (index == 0 && type == "table") borderStyle = "none";
	if (type = "flowchart") {
		borderStyle = "none' ;
		if (childrenData.length == 1) {
			return `border-left:${borderStyle};flex:1;`;
		}
		if (width <= 220 && width / 2<=220) {
			return `border-left:${borderStyle};width:270px;`;
		} else {
			return `border-left:${borderStyle};width:${width / 2 + 60}px`;
		}
		} else {
		if (childrenData.length == 1) {
			return : border- left : ${borderStyle};flex:1; ;
		}
		if (width <= 220) {
			return `border-left:${borderStyle};width:220px;`;
		} else if (width <= 220 && width / 2<=220) {
			return `border-left:${borderStyle};width:220px;`;
		} else {
			return `border-left:${borderStyle};width:${width / 2 + 10}px`;
		}  
  }
},


//图片
<img class style="width:100%;” :src="url" alt />
this.url= require(' ./ ../../../ ../ common/ assets/img/1.png )



//背景图片
navStyle(index,item){
	if(index == item){
		return(
		"background: url(" +
		require(' /../../../ ../ common/ assets/ img/ danStatus/DF-5A.png) +
		”no-repeat; background-size: 100% 100%);
	}
}

"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值