index.uvue
<template>
<view style="flex: 1;background-color: #d1d1d1;">
<list-view :scroll-y="true" class="page" bounces="true" show-scrollbar="true" style="flex: 1;" >
<list-item class="content-item" style="height: 200px;;">
<text class="text">向上滑动页面,体验sticky-header吸顶效果。 </text>
</list-item>
<sticky-item></sticky-item>
</list-view>
</view>
</template>
<script>
export default {
}
</script>
show-scrollbar="false">
<view style="align-self: flex-start; flex-direction: row;">
<text ref="swipertab" style="padding-right: 20px;height: 30px;" v-for="index in 5"
@click="clickTH(index)">
DAAA{{index}}
</text>
</view>
</scroll-view>
</sticky-header>
<list-item>
<swiper :current-item-id="currentItemId">
<swiper-item v-for="i in 5" :item-id="'itemid'+i">
<view v-for="index in 10" :key="index">
<text style="height: 80px;">{{i}}===>{{index}}</text>
</view>
</swiper-item>
</swiper>
</list-item>
</template>
<script>
export default {
name: "stick-item",
data() {
return {
currentItemId: "itemid0"
}
},
methods: {
clickTH: function (index : number) {
console.log(index);
this.currentItemId = "itemid" + index
},
}
}
</script>