You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
951 B

3 weeks ago
<template>
<view v-if="ifshow" class="topcon" @click="gotop">
<image class="topimg" src="/static/image/top.png" mode="aspectFill" lazy-load></image>
</view>
</template>
<script>
export default {
data() {
return {
ifshow:false,
};
},
props: {
scrollTop: {
type: Number,
default: 0
},
},
methods: {
topData(e){
//这个e直接是滚动时候的高度
this.ifshow = e>200;
this.$forceUpdate();
},
gotop(){
uni.pageScrollTo({
scrollTop: 0,
duration: 300 // 动画时长默认300ms
});
}
}
}
</script>
<style lang="scss" scoped>
.topcon{
position: fixed;
right: 20rpx;
bottom: 180rpx;
width: 66rpx;
height: 66rpx;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(243, 244, 239, 0.8);
border-radius: 100% 100%;
border: 1rpx solid #89965f;
z-index: 998;
.topimg{
width: 40rpx;
height: 40rpx;
opacity: 1;
}
}
</style>