美文网首页
特殊的src与style的写法

特殊的src与style的写法

作者: 爱代码的派派星 | 来源:发表于2019-10-18 14:56 被阅读0次
//vue 变量写进style
<div :style="{'color':bgColor}"> 
<div class="top-bg" ref="bg" :style="{'backgroundImage': 'url(' + top_pic_url + ')','color':bgColor}" >

//vue 变量写进url中
<div :style="{'backgroundImage': 'url(' + body_pic_url + ')'}" >
<div :style="{backgroundImage: `url(${actInfo.actPic})`}">

//vue 三目判断写style
<div class="title" :style="{'fontSize': name.length > 16 ? '.5rem' : '.6rem','lineHeight': name.length > 16 ? '.8rem' : '1.6rem','color':bgColor}">

//vue动态绑定class
<span :class="[changeOnOff?'jiaoUp':'jiaoUpActive']" >

//vue 动态拼接class
<span :class="`amo-status-${pageInfo.orderStatus}`">

//拼接写法
url: API.manageApi + `/strategy/${id}/update-strategy`

showTotal: total => `共 ${total} 条记录 第${this.state.current}/${Math.ceil(total / 10)}页`

//扩展运算符
this.results = [...this.results, ...data.list];//将data.list 追加到results

相关文章

网友评论

      本文标题:特殊的src与style的写法

      本文链接:https://www.haomeiwen.com/subject/mybimctx.html