vue 标签动态显示class、style

    <div class="example1 example2"></div>
    <div :class="true?'example1':'example2'"></div>
    <div :class="{ 'example1': true }"></div>
    <div :class="['example1', {'example2':true}]"></div>
    <div style="width:calc(100% - 10px); color:red"></div>
    <div :style="true?{ width: 'calc(100% - 10px)', color: 'red' }:''"></div>
    <div :style="{ width: true?'calc(100% - 10px)':'200px', color: 'red' }"></div>
    <div :style="{ width: `calc(100% - ${aaaa}px)`, color: bbbb }"></div>

猜你喜欢

转载自www.cnblogs.com/XUYIYUAN/p/12313173.html