更新:登录功能

This commit is contained in:
2025-11-04 12:37:04 +08:00
commit a21fb92916
897 changed files with 51500 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
@import '../common/abstracts/variable';
@import '../common/abstracts/mixin';
.wot-theme-dark {
@include b(tabbar) {
background: $-dark-background;
}
}
@include b(tabbar) {
display: flex;
align-items: center;
flex-wrap: nowrap;
position: relative;
background: $-color-white;
height: $-tabbar-height;
@include e(placeholder) {
box-sizing: content-box;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
@include m(round) {
margin-left: 32rpx;
margin-right: 32rpx;
border-radius: 999px;
box-shadow: $-tabbar-box-shadow;
@include when(fixed) {
@include when(safe) {
bottom: constant(safe-area-inset-bottom);
bottom: env(safe-area-inset-bottom);
}
}
}
@include m(default) {
@include when(fixed) {
@include when(safe) {
box-sizing: content-box;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
}
@include when(border) {
@include halfPixelBorder('top');
}
}
@include when(fixed) {
position: fixed;
left: 0;
bottom: 0;
right: 0;
z-index: 500;
}
}

View File

@@ -0,0 +1,73 @@
import { type ExtractPropTypes, type InjectionKey } from 'vue'
import { baseProps, makeBooleanProp, makeNumberProp, makeNumericProp, makeStringProp } from '../common/props'
import type { TabbarItem } from '../wd-tabbar-item/types'
type TabbarShape = 'default' | 'round'
export type TabbarProvide = {
props: {
// 选中标签的索引值或者名称
modelValue?: number | string
// 是否固定在底部
fixed?: boolean
// 是否设置底部安全距离iphone X 类型的机型)
safeAreaInsetBottom?: boolean
// 是否显示顶部边框
bordered?: boolean
// 标签栏的形状。可选项default/round
shape?: TabbarShape
// 激活标签的颜色
activeColor?: string
// 未激活标签的颜色
inactiveColor?: string
// 固定在底部时,是否在标签位置生成一个等高的占位元素
placeholder?: boolean
// 自定义组件的层级
zIndex?: number
}
setChange: (child: TabbarItem) => void
}
export const TABBAR_KEY: InjectionKey<TabbarProvide> = Symbol('wd-tabbar')
export const tabbarProps = {
...baseProps,
/**
* 选中标签的索引值或者名称
*/
modelValue: makeNumericProp(0),
/**
* 是否固定在底部
*/
fixed: makeBooleanProp(false),
/**
* 是否显示顶部边框
*/
bordered: makeBooleanProp(true),
/**
* 是否设置底部安全距离iPhone X 类型的机型)
*/
safeAreaInsetBottom: makeBooleanProp(false),
/**
* 标签栏的形状。可选项default/round
*/
shape: makeStringProp<TabbarShape>('default'),
/**
* 激活标签的颜色
*/
activeColor: String,
/**
* 未激活标签的颜色
*/
inactiveColor: String,
/**
* 固定在底部时,是否在标签位置生成一个等高的占位元素
*/
placeholder: makeBooleanProp(false),
/**
* 自定义组件的层级
*/
zIndex: makeNumberProp(99)
}
export type TabbarProps = ExtractPropTypes<typeof tabbarProps>

View File

@@ -0,0 +1,91 @@
<template>
<view :class="{ 'wd-tabbar__placeholder': fixed && placeholder && safeAreaInsetBottom && shape === 'round' }" :style="{ height: addUnit(height) }">
<view
:class="`wd-tabbar wd-tabbar--${shape} ${customClass} ${fixed ? 'is-fixed' : ''} ${safeAreaInsetBottom ? 'is-safe' : ''} ${
bordered ? 'is-border' : ''
}`"
:style="rootStyle"
>
<slot></slot>
</view>
</view>
</template>
<script lang="ts">
export default {
name: 'wd-tabbar',
options: {
addGlobalClass: true,
virtualHost: true,
styleIsolation: 'shared'
}
}
</script>
<script lang="ts" setup>
import { getCurrentInstance, onMounted, ref, watch, nextTick, computed, type CSSProperties } from 'vue'
import type { TabbarItem } from '../wd-tabbar-item/types'
import { addUnit, getRect, isDef, objToStyle } from '../common/util'
import { useChildren } from '../composables/useChildren'
import { TABBAR_KEY, tabbarProps } from './types'
const props = defineProps(tabbarProps)
const emit = defineEmits(['change', 'update:modelValue'])
const height = ref<number | string>('') // 占位高度
const { proxy } = getCurrentInstance() as any
const { linkChildren } = useChildren(TABBAR_KEY)
linkChildren({
props,
setChange
})
const rootStyle = computed(() => {
const style: CSSProperties = {}
if (isDef(props.zIndex)) {
style['z-index'] = props.zIndex
}
return `${objToStyle(style)}${props.customStyle}`
})
watch(
[() => props.fixed, () => props.placeholder],
() => {
setPlaceholderHeight()
},
{ deep: true, immediate: false }
)
onMounted(() => {
if (props.fixed && props.placeholder) {
nextTick(() => {
setPlaceholderHeight()
})
}
})
/**
* 子项状态变更
* @param child 子项
*/
function setChange(child: TabbarItem) {
let active = child.name
emit('update:modelValue', active)
emit('change', {
value: active
})
}
function setPlaceholderHeight() {
if (!props.fixed || !props.placeholder) {
return
}
getRect('.wd-tabbar', false, proxy).then((res) => {
height.value = Number(res.height)
})
}
</script>
<style lang="scss" scoped>
@import './index.scss';
</style>