v-bind:style绑定时使用正常工作color:
<p v-bind:style="{ color: '#' + tradingCardOption.BorderColorHex }">
{{ tradingCardOption.ColorSetName }}
</p>
Run Code Online (Sandbox Code Playgroud)
但是,绑定到background-color不起作用:
v-bind:style="{ background-color: '#' + tradingCardOption.BorderColorHex }"
Run Code Online (Sandbox Code Playgroud)
也没有绑定到border-top:
v-bind:style="{ border-top: 15px solid + '#' + tradingCardOption.CornerColorHex }"
Run Code Online (Sandbox Code Playgroud)
是什么导致这种条件有条不紊地工作?
<div v-for="tradingCardOption in tradingCardOptions">
<div v-bind:style="{ background-color: '#' + tradingCardOption.BorderColorHex}" class="color-swatch " v-bind:class="{'selected' : $index == 0}" v-on:click="selectTradingCardOption(tradingCardOption, $event)">
<div v-bind:style="{ border-top: 15px solid + '#' + tradingCardOption.CornerColorHex}"></div>
</div> {{ tradingCardOption.BorderColorHex}}
<p v-bind:style="{ color: '#' + tradingCardOption.BorderColorHex}"> {{ tradingCardOption.ColorSetName }}</p>
</div>Run Code Online (Sandbox Code Playgroud)
<textarea name="" id="" cols="30" rows="10" v-model="$store.state.user.giftMessage | truncate 150"></textarea>
我尝试创建一个自定义过滤器:
filters: {
truncate(text, stop, clamp) {
return text.slice(0, stop) + (stop < text.length ? clamp || '...' : '')
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我将其放入输入的v模型中时,构建并没有中断...
有什么建议吗?