div
<div class="topback" v-if="isshow">
<div class="back"><uni-icons color="#fcfcfc" @click="goback" type="arrowleft" size="30"></uni-icons></div>
</div>
<div class="daohang1" v-if="!isshow" :style="{ background: bg }">
<div class="back"><uni-icons color="#999999" @click="goback" type="arrowleft" size="30"></uni-icons></div>
<div class="titlex">#{{ data.name }}#</div>
</div>
js
onPageScroll(res) {
this.top = res.scrollTop;
},
computed: {
// 计算属性的 getter
bg: function() {
// `this` 指向 vm 实例
return 'rgba(255,255,255, ' + this.top / 20 + ')';
},
isshow: function() {
if (this.top > 20) {
return false;
} else {
return true;
}
}
},