更新:登录功能
This commit is contained in:
25
uni_modules/wot-design-uni/components/wd-backtop/index.scss
Normal file
25
uni_modules/wot-design-uni/components/wd-backtop/index.scss
Normal file
@@ -0,0 +1,25 @@
|
||||
@import '../common/abstracts/variable';
|
||||
@import '../common/abstracts/mixin';
|
||||
|
||||
@include b(backtop) {
|
||||
position: fixed;
|
||||
background-color: $-backtop-bg;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: $-color-gray-8;
|
||||
|
||||
@include edeep(backicon) {
|
||||
font-size: $-backtop-icon-size;
|
||||
}
|
||||
|
||||
@include when(circle) {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
@include when(square) {
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
37
uni_modules/wot-design-uni/components/wd-backtop/types.ts
Normal file
37
uni_modules/wot-design-uni/components/wd-backtop/types.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { baseProps, makeNumberProp, makeRequiredProp, makeStringProp } from '../common/props'
|
||||
|
||||
export const backtopProps = {
|
||||
...baseProps,
|
||||
/**
|
||||
* 页面滚动距离
|
||||
*/
|
||||
scrollTop: makeRequiredProp(Number),
|
||||
/**
|
||||
* 距离顶部多少距离时显示
|
||||
*/
|
||||
top: makeNumberProp(300),
|
||||
/**
|
||||
* 返回顶部滚动时间
|
||||
*/
|
||||
duration: makeNumberProp(100),
|
||||
/**
|
||||
* 层级
|
||||
*/
|
||||
zIndex: makeNumberProp(10),
|
||||
/**
|
||||
* icon样式
|
||||
*/
|
||||
iconStyle: makeStringProp(''),
|
||||
/**
|
||||
* 形状
|
||||
*/
|
||||
shape: makeStringProp('circle'),
|
||||
/**
|
||||
* 距离屏幕底部距离
|
||||
*/
|
||||
bottom: makeNumberProp(100),
|
||||
/**
|
||||
* 距离屏幕右边距离
|
||||
*/
|
||||
right: makeNumberProp(20)
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<wd-transition :show="show" name="fade">
|
||||
<view
|
||||
:class="`wd-backtop ${customClass} is-${shape}`"
|
||||
:style="`z-index: ${zIndex}; bottom: ${bottom}px; right: ${right}px; ${customStyle}`"
|
||||
@click="handleBacktop"
|
||||
>
|
||||
<slot v-if="$slots.default"></slot>
|
||||
<wd-icon v-else custom-class="wd-backtop__backicon" name="backtop" :custom-style="iconStyle" />
|
||||
</view>
|
||||
</wd-transition>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'wd-backtop',
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
virtualHost: true,
|
||||
styleIsolation: 'shared'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import wdTransition from '../wd-transition/wd-transition.vue'
|
||||
import wdIcon from '../wd-icon/wd-icon.vue'
|
||||
import { computed } from 'vue'
|
||||
import { backtopProps } from './types'
|
||||
|
||||
const props = defineProps(backtopProps)
|
||||
|
||||
const show = computed(() => props.scrollTop > props.top)
|
||||
|
||||
function handleBacktop() {
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: props.duration
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './index.scss';
|
||||
</style>
|
||||
Reference in New Issue
Block a user