更新:登录功能
This commit is contained in:
17
uni_modules/wot-design-uni/components/wd-overlay/index.scss
Normal file
17
uni_modules/wot-design-uni/components/wd-overlay/index.scss
Normal file
@@ -0,0 +1,17 @@
|
||||
@import "./../common/abstracts/_mixin.scss";
|
||||
@import "./../common/abstracts/variable.scss";
|
||||
|
||||
.wot-theme-dark {
|
||||
@include b(overlay) {
|
||||
background: $-overlay-bg-dark;
|
||||
}
|
||||
}
|
||||
|
||||
@include b(overlay) {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: $-overlay-bg;
|
||||
}
|
||||
25
uni_modules/wot-design-uni/components/wd-overlay/types.ts
Normal file
25
uni_modules/wot-design-uni/components/wd-overlay/types.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { PropType } from 'vue'
|
||||
import { baseProps, makeBooleanProp, makeNumberProp } from '../common/props'
|
||||
|
||||
export const overlayProps = {
|
||||
...baseProps,
|
||||
/**
|
||||
* 是否展示遮罩层
|
||||
*/
|
||||
show: makeBooleanProp(false),
|
||||
/**
|
||||
* 动画时长,单位毫秒
|
||||
*/
|
||||
duration: {
|
||||
type: [Object, Number, Boolean] as PropType<Record<string, number> | number | boolean>,
|
||||
default: 300
|
||||
},
|
||||
/**
|
||||
* 是否锁定滚动
|
||||
*/
|
||||
lockScroll: makeBooleanProp(true),
|
||||
/**
|
||||
* 层级
|
||||
*/
|
||||
zIndex: makeNumberProp(10)
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<wd-transition
|
||||
:show="show"
|
||||
name="fade"
|
||||
custom-class="wd-overlay"
|
||||
:duration="duration"
|
||||
:custom-style="`z-index: ${zIndex}; ${customStyle}`"
|
||||
:disable-touch-move="lockScroll"
|
||||
@click="handleClick"
|
||||
>
|
||||
<slot></slot>
|
||||
</wd-transition>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'wd-overlay',
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: 'shared'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import wdTransition from '../wd-transition/wd-transition.vue'
|
||||
import { overlayProps } from './types'
|
||||
// #ifdef H5
|
||||
import { useLockScroll } from '../composables/useLockScroll'
|
||||
// #endif
|
||||
|
||||
const props = defineProps(overlayProps)
|
||||
|
||||
const emit = defineEmits(['click'])
|
||||
|
||||
function handleClick() {
|
||||
emit('click')
|
||||
}
|
||||
|
||||
// #ifdef H5
|
||||
useLockScroll(() => props.show && props.lockScroll)
|
||||
// #endif
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import './index.scss';
|
||||
</style>
|
||||
Reference in New Issue
Block a user