Files
pad-nl-three-uni/components/upTop.vue
2024-12-18 14:02:59 +08:00

49 lines
781 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: 11px;
bottom: 11px;
background-color: rgba(4, 19, 36, 70%);
width: 40px;
height: 40px;
line-height: 40px;
border-radius: 50%;
text-align: center;
box-shadow: 1px 2px 5px #114d90;
</style>