特殊的src与style的写法

2019-10-18  本文已影响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
上一篇 下一篇

猜你喜欢

热点阅读