代码
<template>
<div class="my-app">
<div class="nav">
<div class="item" v-for="n in 30" @click="scroll" :key="n">{{n}}</div>
</div>
<div class="body">
<div class="item2" v-for="p in 200" :key="p">{{p}}</div>
</div>
</div>
</template>
<script>
export default {
data: function () {
return {
}
},
methods: {
scroll () {
this.top = this.top ? 0 : 100000
uni.pageScrollTo({
scrollTop: this.top,
duration: 300,
})
}
}
}
</script>
<style lang="scss" scoped>
.my-app {
text-align: center;
}
.nav {
position: fixed;
width: 150px;
height: 100vh;
overflow: auto;
background-color: #ccc;
}
.item2 {
height: 200px;
border: 1px solid #837;
}
.item {
height: 50px;
border: 1px solid #6cf;
}
</style>
1 个回复
违规昵称4396
2020年就有人提这个问题。到现在还没解决