绑定样式

8 阅读1分钟
1.
<scroll-view :style="{height: scrollHeight+'px'}"></scroll-view>
computed: {
    scrollHeight() {
        let info = uni.getSystemInfoSync()
        return info.windowHeight - 170; // 单位PX
    }
}
    
2.
<scroll-view style="height: calc(100vh - 160rpx)"></scroll-view>
    
3.
<view :style="{color: index == curIndex? '#FFF' : '#333'}"></view>
<view :style="{display: status? 'block' : 'none', width: width + 'px', transform: 'translateX(' + translateXC + 'px)'}"</view>

4.
<view :class="flag == 1? 'active' : ''"></view>
<view :class="[item.status == 1? 'sign-out' : 'sign-in', auth? '' : 'disabled-btn']"></view>
<view :class="{'active': currentId == item.id, 'is-dot': item.hot}"></view>