更新:登录功能

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,9 @@
@import '../common/abstracts/variable';
@import '../common/abstracts/mixin';
@include b(grid) {
position: relative;
box-sizing: border-box;
overflow: hidden;
height: auto;
}

View File

@@ -0,0 +1,59 @@
/*
* @Author: weisheng
* @Date: 2023-12-14 11:21:58
* @LastEditTime: 2024-03-18 14:38:35
* @LastEditors: weisheng
* @Description:
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-grid\types.ts
* 记得注释
*/
import { type ExtractPropTypes, type InjectionKey } from 'vue'
import { baseProps, makeBooleanProp, makeStringProp } from '../common/props'
export type GridProvide = {
props: {
clickable?: boolean
square?: boolean
column?: number
border?: boolean
bgColor?: string
gutter?: number
hoverClass?: string
}
}
export const GRID_KEY: InjectionKey<GridProvide> = Symbol('wd-grid')
export const gridProps = {
...baseProps,
/**
* 是否开启格子点击反馈
*/
clickable: makeBooleanProp(false),
/**
* 是否将格子固定为正方形
*/
square: makeBooleanProp(false),
/**
* 列数
*/
column: Number,
/**
* 是否显示边框
*/
border: makeBooleanProp(false),
/**
* 背景颜色
*/
bgColor: makeStringProp(''),
/**
* 格子之间的间距默认单位为px
*/
gutter: Number,
/**
* 自定义内容区域hover-class
*/
hoverClass: String
}
export type GridProps = ExtractPropTypes<typeof gridProps>

View File

@@ -0,0 +1,106 @@
<template>
<view :class="`wd-grid ${customClass}`" :style="rootStyle">
<!-- 默认插入的 item -->
<slot />
</view>
</template>
<script lang="ts">
export default {
name: 'wd-grid',
options: {
virtualHost: true,
addGlobalClass: true,
styleIsolation: 'shared'
}
}
</script>
<script lang="ts" setup>
import { computed, watch } from 'vue'
import { useChildren } from '../composables/useChildren'
import { GRID_KEY, gridProps } from './types'
import { debounce } from '../common/util'
const nextTick = () => new Promise((resolve) => setTimeout(resolve, 20))
const props = defineProps(gridProps)
// 子元素个数
const { linkChildren, children } = useChildren(GRID_KEY)
linkChildren({ props })
watch(
() => props.column,
(val, oldVal) => {
if (val === oldVal) return
if (!val || val <= 0) {
console.error(
'The number of columns attribute value is invalid. The attribute must be greater than 0 and it is not recommended to use a larger value attribute.'
)
}
oldVal && init()
},
{
deep: true,
immediate: true
}
)
watch(
() => props.border,
(val) => {
val &&
Promise.resolve()
.then(nextTick)
.then(() => {
init()
})
},
{
deep: true,
immediate: true
}
)
watch(
() => children,
() => {
handleChildrenChange()
},
{
deep: true
}
)
const rootStyle = computed(() => {
return `${props.gutter ? 'padding-left:' + props.gutter + 'px;' + 'padding-bottom:' + props.gutter + 'px;' : ''}${props.customStyle}`
})
const handleChildrenChange = debounce(() => {
init()
}, 50)
function init() {
if (!children) return
children.forEach((item, index) => {
if (props.border) {
const { column } = props
if (column) {
const isRightItem = children.length - 1 === index || (index + 1) % column === 0
const isFirstLine = index + 1 <= column
isFirstLine && item.$.exposed!.setiIemClass('is-first')
isRightItem && item.$.exposed!.setiIemClass('is-right')
!isFirstLine && item.$.exposed!.setiIemClass('is-border')
} else {
item.$.exposed!.setiIemClass('is-first')
}
children.length - 1 === index && item.$.exposed!.setiIemClass(item.$.exposed!.itemClass.value + ' is-last')
}
item.$.exposed!.init()
})
}
</script>
<style lang="scss" scoped>
@import './index.scss';
</style>