Files
hht-tongbo-two/components/upTop.vue
2024-05-11 14:09:08 +08:00

49 lines
782 B
Vue

<template>
<view class="back-top" @tap="toTop" v-show="showBtn">
<uni-icons type="arrow-up" size="26" color="#9a99ac"></uni-icons>
</view>
</template>
<script>
export default {
name:"upTop",
data() {
return {
showBtn: false
};
},
props: {
scrollTop: {
type: Number,
default: 0
}
},
methods: {
topData(e) {
this.showBtn = e > 50
},
// 返回顶部
toTop() {
uni.pageScrollTo({
scrollTop: 0,
duration: 100
})
}
}
}
</script>
<style lang="stylus" scoped>
.back-top
position: fixed;
z-index: 299;
right: 10rpx;
bottom: 130rpx;
background-color: #fff;
width: 70rpx;
height: 70rpx;
line-height: 70rpx;
border-radius: 50%;
text-align: center;
box-shadow: 0 4rpx 16rpx rgba(28,31,35,.3);
</style>