返回顶部组件
This commit is contained in:
@@ -54,7 +54,8 @@
|
||||
_fj()
|
||||
position fixed
|
||||
_wh(100%, calc(var(--status-bar-height) + 72rpx))
|
||||
background: linear-gradient(to bottom, #ff6800 0%, #ff6400 100%)
|
||||
// background: linear-gradient(to bottom, #ff6800 0%, #ff6400 100%)
|
||||
background-color $red
|
||||
z-index 200
|
||||
padding var(--status-bar-height) 20rpx 0
|
||||
.page_name
|
||||
|
||||
49
components/upTop.vue
Normal file
49
components/upTop.vue
Normal file
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<view class="back-top" @tap="toTop" v-show="showBtn">
|
||||
<uni-icons class="zd_icon_wraper" type="arrow-up" size="30"></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: 9999;
|
||||
right: 20rpx;
|
||||
bottom: 150rpx;
|
||||
background-color: #fff;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
box-shadow: 0 4rpx 16rpx rgba(28,31,35,.3);
|
||||
</style>
|
||||
Reference in New Issue
Block a user