From a9462fa11983abeb23673ddce13bb80fbcdb06d0 Mon Sep 17 00:00:00 2001 From: log1997 <2694233102@qq.com> Date: Sun, 4 Jan 2026 11:21:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?style:=20=F0=9F=92=84=20=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/Cargo.lock | 2 +- src/api/request.ts | 82 ++-- src/assets/md/readme-en.md | 2 +- src/components/DaiysuiTable/index.vue | 28 +- src/components/Dialog/index.vue | 36 +- src/components/Drawer/index.vue | 12 +- src/components/FileUpload/index.vue | 38 +- src/components/HelloWorld.vue | 2 +- src/components/ImageSync/index.vue | 26 +- .../NumberSeparate/EditSeparateDialog.vue | 94 ++-- src/components/PageHeader/index.vue | 2 +- src/components/SvgIcon/index.vue | 32 +- src/components/Waterfall/index.vue | 70 +-- src/components/ui/button/Button.vue | 20 +- src/components/ui/button/index.ts | 64 +-- src/components/ui/command/Command.vue | 100 ++-- src/components/ui/command/CommandDialog.vue | 14 +- src/components/ui/command/CommandEmpty.vue | 18 +- src/components/ui/command/CommandGroup.vue | 26 +- src/components/ui/command/CommandInput.vue | 20 +- src/components/ui/command/CommandItem.vue | 68 +-- src/components/ui/command/CommandList.vue | 14 +- .../ui/command/CommandSeparator.vue | 14 +- src/components/ui/command/CommandShortcut.vue | 6 +- src/components/ui/command/index.ts | 40 +- src/components/ui/dialog/Dialog.vue | 4 +- src/components/ui/dialog/DialogClose.vue | 4 +- src/components/ui/dialog/DialogContent.vue | 30 +- .../ui/dialog/DialogDescription.vue | 14 +- src/components/ui/dialog/DialogFooter.vue | 6 +- src/components/ui/dialog/DialogHeader.vue | 6 +- src/components/ui/dialog/DialogOverlay.vue | 14 +- .../ui/dialog/DialogScrollContent.vue | 28 +- src/components/ui/dialog/DialogTitle.vue | 14 +- src/components/ui/dialog/DialogTrigger.vue | 4 +- src/components/ui/dialog/index.ts | 20 +- .../ui/dropdown-menu/DropdownMenu.vue | 4 +- .../DropdownMenuCheckboxItem.vue | 22 +- .../ui/dropdown-menu/DropdownMenuContent.vue | 28 +- .../ui/dropdown-menu/DropdownMenuGroup.vue | 4 +- .../ui/dropdown-menu/DropdownMenuItem.vue | 20 +- .../ui/dropdown-menu/DropdownMenuLabel.vue | 14 +- .../dropdown-menu/DropdownMenuRadioGroup.vue | 8 +- .../dropdown-menu/DropdownMenuRadioItem.vue | 22 +- .../dropdown-menu/DropdownMenuSeparator.vue | 16 +- .../ui/dropdown-menu/DropdownMenuShortcut.vue | 6 +- .../ui/dropdown-menu/DropdownMenuSub.vue | 8 +- .../dropdown-menu/DropdownMenuSubContent.vue | 18 +- .../dropdown-menu/DropdownMenuSubTrigger.vue | 20 +- .../ui/dropdown-menu/DropdownMenuTrigger.vue | 4 +- src/components/ui/dropdown-menu/index.ts | 30 +- src/components/ui/popover/Popover.vue | 4 +- src/components/ui/popover/PopoverAnchor.vue | 4 +- src/components/ui/popover/PopoverContent.vue | 30 +- src/components/ui/popover/PopoverTrigger.vue | 4 +- src/components/ui/popover/index.ts | 8 +- src/components/ui/sonner/Sonner.vue | 8 +- src/components/ui/sonner/index.ts | 2 +- src/components/ui/switch/Switch.vue | 20 +- src/components/ui/switch/index.ts | 2 +- src/layout/Footer/config.ts | 16 +- src/layout/Footer/index.vue | 2 +- src/layout/Header/config.ts | 30 +- src/layout/Header/index.vue | 2 +- src/layout/RightButton/index.vue | 16 +- src/layout/index.vue | 8 +- src/lib/utils.ts | 8 +- src/locales/i18n.ts | 32 +- src/locales/modules/button.ts | 108 ++--- src/locales/modules/dialog.ts | 52 +- src/locales/modules/error.ts | 102 ++-- src/locales/modules/placeHolder.ts | 32 +- src/locales/modules/tooltip.ts | 72 +-- src/store/index.ts | 12 +- src/store/prizeConfig.ts | 328 ++++++------- src/store/system.ts | 58 +-- src/utils/auth.ts | 2 +- src/utils/color.ts | 26 +- src/utils/file.ts | 16 +- src/utils/format/tree.ts | 2 +- src/utils/store.ts | 12 +- .../FaceConfig/components/PatternEdit.vue | 50 +- .../FaceConfig/components/SelectFont.vue | 44 +- .../FaceConfig/components/UploadDialog.vue | 48 +- src/views/Config/Global/FaceConfig/index.vue | 64 +-- .../Global/FaceConfig/parts/DataSetting.vue | 6 +- .../Global/FaceConfig/parts/LayoutSetting.vue | 4 +- .../FaceConfig/parts/PatternSetting.vue | 12 +- .../Global/FaceConfig/parts/ThemeSetting.vue | 2 +- .../Config/Global/FaceConfig/useViewModel.ts | 448 +++++++++--------- .../ImageConfig/components/UploadDialog.vue | 98 ++-- src/views/Config/Global/ImageConfig/index.vue | 24 +- .../MusicConfig/components/UploadDialog.vue | 120 ++--- src/views/Config/Global/MusicConfig/index.vue | 23 +- .../PersonAll/components/SinglePerson.vue | 4 +- .../Person/PersonAll/importExcel.worker.ts | 50 +- src/views/Config/Person/PersonAll/index.vue | 20 +- .../Config/Person/PersonAll/useViewModel.ts | 336 ++++++------- src/views/Config/Prize/usePrizeConfig.ts | 236 ++++----- src/views/Config/Readme/index.vue | 34 +- src/views/Config/index.vue | 22 +- src/views/Demo/index.vue | 202 ++++---- .../Home/components/HeaderTitle/index.vue | 38 +- .../Home/components/OptionsButton/index.vue | 14 +- src/views/Home/components/PrizeList/index.vue | 24 +- .../parts/OfficialPrizeList/index.vue | 62 +-- .../PrizeList/parts/OperationButton.vue | 6 +- .../PrizeList/parts/TemporaryDialog.vue | 18 +- .../PrizeList/parts/TemporaryList.vue | 6 +- .../Home/components/StarsBackground/index.vue | 64 +-- 110 files changed, 2146 insertions(+), 2149 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index a5a2c37..5a56935 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -77,7 +77,7 @@ checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "app" -version = "0.5.1" +version = "0.5.2" dependencies = [ "log", "serde", diff --git a/src/api/request.ts b/src/api/request.ts index 0076f64..1f0e1c5 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -2,61 +2,61 @@ import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosReq import axios from 'axios' class Request { - private instance: AxiosInstance + private instance: AxiosInstance - constructor(config: AxiosRequestConfig) { - this.instance = axios.create({ - baseURL: '/api', - timeout: 10000, - ...config, - }) + constructor(config: AxiosRequestConfig) { + this.instance = axios.create({ + baseURL: '/api', + timeout: 10000, + ...config, + }) - // 添加请求拦截器 - this.instance.interceptors.request.use( - (config: InternalAxiosRequestConfig) => { - // 在发送请求之前做些什么 - console.log('请求拦截器被触发') + // 添加请求拦截器 + this.instance.interceptors.request.use( + (config: InternalAxiosRequestConfig) => { + // 在发送请求之前做些什么 + console.log('请求拦截器被触发') - return config - }, - (error: any) => { - // 对请求错误做些什么 - console.error('请求拦截器发生错误:', error) + return config + }, + (error: any) => { + // 对请求错误做些什么 + console.error('请求拦截器发生错误:', error) - return Promise.reject(error) - }, - ) + return Promise.reject(error) + }, + ) - // 添加响应拦截器 - this.instance.interceptors.response.use( - (response: AxiosResponse) => { - // 对响应数据做些什么 - console.log('响应拦截器被触发') - const responseData = response.data + // 添加响应拦截器 + this.instance.interceptors.response.use( + (response: AxiosResponse) => { + // 对响应数据做些什么 + console.log('响应拦截器被触发') + const responseData = response.data - return responseData - }, - (error: any) => { - // 对响应错误做些什么 - console.error('响应拦截器发生错误:', error) + return responseData + }, + (error: any) => { + // 对响应错误做些什么 + console.error('响应拦截器发生错误:', error) - return Promise.reject(error) - }, - ) - } + return Promise.reject(error) + }, + ) + } - public async request(config: AxiosRequestConfig): Promise { - const response: AxiosResponse = await this.instance.request(config) + public async request(config: AxiosRequestConfig): Promise { + const response: AxiosResponse = await this.instance.request(config) - return response.data - } + return response.data + } } // 函数 function request(config: AxiosRequestConfig): Promise { - const instance = new Request(config) + const instance = new Request(config) - return instance.request(config) + return instance.request(config) } export default request diff --git a/src/assets/md/readme-en.md b/src/assets/md/readme-en.md index a18f483..1937aab 100644 --- a/src/assets/md/readme-en.md +++ b/src/assets/md/readme-en.md @@ -28,4 +28,4 @@ Shortcuts are set up on the draw page. | Shortcut | Description | | --- | --- | | Space | Enter Draw / Start / Draw Lucky Winner / Continue | -| Esc | Cancel | \ No newline at end of file +| Esc | Cancel | diff --git a/src/components/DaiysuiTable/index.vue b/src/components/DaiysuiTable/index.vue index 0b0f0a0..1d6a337 100644 --- a/src/components/DaiysuiTable/index.vue +++ b/src/components/DaiysuiTable/index.vue @@ -3,28 +3,28 @@ import { computed } from 'vue' import { useI18n } from 'vue-i18n' const props = defineProps({ - data: { - type: Array as any, - default: [] as any[], - }, - tableColumns: { - type: Array, - default: [] as any[], - }, + data: { + type: Array as any, + default: [] as any[], + }, + tableColumns: { + type: Array, + default: [] as any[], + }, }) const { t } = useI18n() const dataColumns = computed(() => { - // 不带有actions的列 - const columns = props.tableColumns.filter((item: any) => !item.actions) + // 不带有actions的列 + const columns = props.tableColumns.filter((item: any) => !item.actions) - return columns + return columns }) const actionsColumns = computed(() => { - // 带有actions的列 - const columns = props.tableColumns.filter((item: any) => item.actions) + // 带有actions的列 + const columns = props.tableColumns.filter((item: any) => item.actions) - return columns + return columns }) diff --git a/src/components/Dialog/index.vue b/src/components/Dialog/index.vue index 4904201..419d507 100644 --- a/src/components/Dialog/index.vue +++ b/src/components/Dialog/index.vue @@ -3,40 +3,40 @@ import { onMounted, ref, toRefs } from 'vue' import i18n from '@/locales/i18n' interface Props { - title: string - desc?: string - cancelText?: string - submitText?: string - submitFunc?: () => void - cancelFunc?: () => void + title: string + desc?: string + cancelText?: string + submitText?: string + submitFunc?: () => void + cancelFunc?: () => void } const props = withDefaults(defineProps(), { - cancelText: i18n.global.t('button.cancel'), - submitText: i18n.global.t('button.confirm'), - cancelFunc: () => {}, + cancelText: i18n.global.t('button.cancel'), + submitText: i18n.global.t('button.confirm'), + cancelFunc: () => {}, }) const visible = defineModel('visible', { - type: Boolean, - default: false, + type: Boolean, + default: false, }) const dialogRef = ref (null) function defaultCancelFunc() { - dialogRef.value?.close() + dialogRef.value?.close() } function showDialog() { - dialogRef.value?.showModal() + dialogRef.value?.showModal() } defineExpose({ - showDialog, - closed, + showDialog, + closed, }) onMounted(() => { - dialogRef.value?.addEventListener('close', () => { - visible.value = false - }) + dialogRef.value?.addEventListener('close', () => { + visible.value = false + }) }) const { title, desc, cancelText, submitText, submitFunc, cancelFunc = defaultCancelFunc } = toRefs(props) diff --git a/src/components/Drawer/index.vue b/src/components/Drawer/index.vue index 67eedb2..9bf4487 100644 --- a/src/components/Drawer/index.vue +++ b/src/components/Drawer/index.vue @@ -4,16 +4,16 @@ import { ref } from 'vue' const drawerTriggerRef = ref (null) const visible = ref(false) function showDrawer() { - drawerTriggerRef.value?.click() - visible.value = true + drawerTriggerRef.value?.click() + visible.value = true } function closeDrawer() { - drawerTriggerRef.value?.click() - visible.value = false + drawerTriggerRef.value?.click() + visible.value = false } defineExpose({ - showDrawer, - closeDrawer, + showDrawer, + closeDrawer, }) diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index a391965..d94aee0 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -2,38 +2,38 @@ import type { IFileData } from './type' import { ListMusic, Upload, X } from 'lucide-vue-next' import { ref } from 'vue' -import { getBlobObjectUrl, readFileAsJsonData, readFileData, readFileDataAsBlob } from '@/utils/file' +import { getBlobObjectUrl, readFileAsJsonData, readFileDataAsBlob } from '@/utils/file' const props = defineProps<{ - limitType?: string - mode?: 'file' | 'json' + limitType?: string + mode?: 'file' | 'json' }>() const emits = defineEmits<{ - uploadFile: [fileData: IFileData | null] + uploadFile: [fileData: IFileData | null] }>() const originFileName = ref(null) const fileData = ref(null) async function handleFileChange(e: Event) { - const file = ((e.target as HTMLInputElement).files as FileList)[0] - const type = file.type - if (props.mode === 'json') { - const fileRes = await readFileAsJsonData(file) - const jsonData = JSON.parse(fileRes) - fileData.value = { data: jsonData, fileName: file.name, type } - originFileName.value = file.name + const file = ((e.target as HTMLInputElement).files as FileList)[0] + const type = file.type + if (props.mode === 'json') { + const fileRes = await readFileAsJsonData(file) + const jsonData = JSON.parse(fileRes) + fileData.value = { data: jsonData, fileName: file.name, type } + originFileName.value = file.name + emits('uploadFile', fileData.value) + return + } + const { data: blobData, fileName } = await readFileDataAsBlob(file) + fileData.value = { data: blobData, fileName, type } + originFileName.value = fileName emits('uploadFile', fileData.value) - return - } - const { data: blobData, fileName } = await readFileDataAsBlob(file) - fileData.value = { data: blobData, fileName, type } - originFileName.value = fileName - emits('uploadFile', fileData.value) } function removeFile() { - fileData.value = null - emits('uploadFile', null) + fileData.value = null + emits('uploadFile', null) } diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue index 408cd08..cfcf1f1 100644 --- a/src/components/HelloWorld.vue +++ b/src/components/HelloWorld.vue @@ -5,7 +5,7 @@ defineProps<{ msg: string }>() const count = ref(0) function addCount() { - count.value++ + count.value++ } diff --git a/src/components/ImageSync/index.vue b/src/components/ImageSync/index.vue index 014c5ba..8e46f6c 100644 --- a/src/components/ImageSync/index.vue +++ b/src/components/ImageSync/index.vue @@ -5,31 +5,31 @@ import localforage from 'localforage' import { onMounted, ref } from 'vue' interface IProps { - imgItem: IImage + imgItem: IImage } const props = defineProps() const imageDbStore = localforage.createInstance({ - name: 'imgStore', + name: 'imgStore', }) const imgUrl = ref('') async function getImageStoreItem(item: IImage): Promise { - let image = '' - if (item.url === 'Storage') { - const key = item.id - const imageData = await imageDbStore.getItem(key) - image = URL.createObjectURL(imageData?.data as Blob) - } - else { - image = item.url as string - } + let image = '' + if (item.url === 'Storage') { + const key = item.id + const imageData = await imageDbStore.getItem(key) + image = URL.createObjectURL(imageData?.data as Blob) + } + else { + image = item.url as string + } - return image + return image } onMounted(async () => { - imgUrl.value = await getImageStoreItem(props.imgItem) + imgUrl.value = await getImageStoreItem(props.imgItem) }) diff --git a/src/components/NumberSeparate/EditSeparateDialog.vue b/src/components/NumberSeparate/EditSeparateDialog.vue index e5d7a62..9982ce0 100644 --- a/src/components/NumberSeparate/EditSeparateDialog.vue +++ b/src/components/NumberSeparate/EditSeparateDialog.vue @@ -4,14 +4,14 @@ import { onMounted, ref, toRefs, watch } from 'vue' import { useI18n } from 'vue-i18n' const props = defineProps({ - totalNumber: { - type: Number, - default: 0, - }, - separatedNumber: { - type: Array, - default: [], - }, + totalNumber: { + type: Number, + default: 0, + }, + separatedNumber: { + type: Array, + default: [], + }, }) const emits = defineEmits(['submitData']) const { t } = useI18n() @@ -19,55 +19,55 @@ const separatedNumberRef = ref() const { separatedNumber, totalNumber } = toRefs(props) const scaleList = ref([]) function editScale(item: number) { - if (item === totalNumber.value) { - return - } - if (scaleList.value.includes(item)) { - const index = scaleList.value.indexOf(item) - scaleList.value.splice(index, 1) - separatedNumber.value.splice(index, 1) - } - else { - scaleList.value.push(item) - scaleList.value.sort((a, b) => a - b) - } + if (item === totalNumber.value) { + return + } + if (scaleList.value.includes(item)) { + const index = scaleList.value.indexOf(item) + scaleList.value.splice(index, 1) + separatedNumber.value.splice(index, 1) + } + else { + scaleList.value.push(item) + scaleList.value.sort((a, b) => a - b) + } } function clearData() { - emits('submitData', separatedNumber.value) - separatedNumberRef.value.close() + emits('submitData', separatedNumber.value) + separatedNumberRef.value.close() } watch(scaleList, (val: number[]) => { - separatedNumber.value.length = 0 - for (let i = 1; i < scaleList.value.length; i++) { - separatedNumber.value[i - 1] = { - id: i.toString(), - count: val[i] - val[i - 1], - isUsedCount: 0, + separatedNumber.value.length = 0 + for (let i = 1; i < scaleList.value.length; i++) { + separatedNumber.value[i - 1] = { + id: i.toString(), + count: val[i] - val[i - 1], + isUsedCount: 0, + } } - } }, { deep: true }) watch(totalNumber, (val) => { - if (val <= 0) { - return - } - separatedNumberRef.value.showModal() - // scaleList.value = [0, val] - scaleList.value = Array.from({ length: separatedNumber.value.length + 1 }).fill(totalNumber.value) as number[] - for (let i = separatedNumber.value.length - 1; i >= 0; i--) { - scaleList.value[i] = scaleList.value[i + 1] - separatedNumber.value[i].count - } - if (scaleList.value[0] !== 0) { - scaleList.value.unshift(0) - } + if (val <= 0) { + return + } + separatedNumberRef.value.showModal() + // scaleList.value = [0, val] + scaleList.value = Array.from({ length: separatedNumber.value.length + 1 }).fill(totalNumber.value) as number[] + for (let i = separatedNumber.value.length - 1; i >= 0; i--) { + scaleList.value[i] = scaleList.value[i + 1] - separatedNumber.value[i].count + } + if (scaleList.value[0] !== 0) { + scaleList.value.unshift(0) + } }) onMounted(() => { - // 阻止esc事件 - document.addEventListener('keydown', (e) => { - if (e.key === 'Escape') { - e.preventDefault() - } - }) + // 阻止esc事件 + document.addEventListener('keydown', (e) => { + if (e.key === 'Escape') { + e.preventDefault() + } + }) }) diff --git a/src/components/PageHeader/index.vue b/src/components/PageHeader/index.vue index fd14914..82e2fb4 100644 --- a/src/components/PageHeader/index.vue +++ b/src/components/PageHeader/index.vue @@ -1,6 +1,6 @@ diff --git a/src/components/SvgIcon/index.vue b/src/components/SvgIcon/index.vue index 44b9325..25c2cd9 100644 --- a/src/components/SvgIcon/index.vue +++ b/src/components/SvgIcon/index.vue @@ -2,22 +2,22 @@ import { computed } from 'vue' const props = defineProps({ - prefix: { - type: String, - default: 'icon', - }, - name: { - type: String, - required: true, - }, - color: { - type: String, - default: '#242424', - }, - size: { - type: String, - default: '24px', - }, + prefix: { + type: String, + default: 'icon', + }, + name: { + type: String, + required: true, + }, + color: { + type: String, + default: '#242424', + }, + size: { + type: String, + default: '24px', + }, }) const symbolId = computed(() => `#${props.prefix}-${props.name}`) diff --git a/src/components/Waterfall/index.vue b/src/components/Waterfall/index.vue index 3c01b91..06e14c0 100644 --- a/src/components/Waterfall/index.vue +++ b/src/components/Waterfall/index.vue @@ -6,16 +6,16 @@ import { nextTick, onMounted, onUnmounted, ref } from 'vue' // 布局参数 Props interface MasonryWaterfallProps { - columnWidth?: number | string // 列宽(px/选择器) - gutter?: number // 列/行间距 - fitWidth?: boolean // 容器宽度自适应居中 + columnWidth?: number | string // 列宽(px/选择器) + gutter?: number // 列/行间距 + fitWidth?: boolean // 容器宽度自适应居中 } // 默认参数 const props = withDefaults(defineProps(), { - columnWidth: 120, - gutter: 16, - fitWidth: true, + columnWidth: 120, + gutter: 16, + fitWidth: true, }) // Vue Ref 管理 DOM 容器和 masonry 实例 @@ -24,52 +24,52 @@ const masonryInstance: Ref = ref(null) // 初始化 masonry(仅执行一次,因卡片固定) async function initMasonry() { - if (!masonryContainer.value) - return + if (!masonryContainer.value) + return - // 等待插槽内容(固定卡片)完全渲染 - await nextTick() + // 等待插槽内容(固定卡片)完全渲染 + await nextTick() - // 初始化 masonry 实例(固定卡片无需销毁旧实例) - masonryInstance.value = new Masonry(masonryContainer.value, { - itemSelector: '.masonry-container > *', // 匹配所有固定子项 - columnWidth: props.columnWidth, - gutter: props.gutter, - fitWidth: props.fitWidth, - initLayout: true, // 固定卡片直接初始化布局 - }) + // 初始化 masonry 实例(固定卡片无需销毁旧实例) + masonryInstance.value = new Masonry(masonryContainer.value, { + itemSelector: '.masonry-container > *', // 匹配所有固定子项 + columnWidth: props.columnWidth, + gutter: props.gutter, + fitWidth: props.fitWidth, + initLayout: true, // 固定卡片直接初始化布局 + }) } // 刷新布局(仅用于卡片内部内容高度变化) async function refreshLayout() { - await nextTick() - if (masonryInstance.value) { - masonryInstance.value.layout?.() - } + await nextTick() + if (masonryInstance.value) { + masonryInstance.value.layout?.() + } } // 窗口缩放节流重排(优化性能) const handleResize = throttle(() => { - if (masonryInstance.value) { - masonryInstance.value.layout?.() - } + if (masonryInstance.value) { + masonryInstance.value.layout?.() + } }, 300) // 生命周期:挂载时初始化,卸载时清理 onMounted(async () => { - await initMasonry() - window.addEventListener('resize', handleResize) + await initMasonry() + window.addEventListener('resize', handleResize) }) onUnmounted(() => { - // 销毁实例 + 释放内存 - if (masonryInstance.value) { - masonryInstance.value.destroy?.() - masonryInstance.value = null - } - // 移除监听 + 取消节流任务 - window.removeEventListener('resize', handleResize) - handleResize.cancel() + // 销毁实例 + 释放内存 + if (masonryInstance.value) { + masonryInstance.value.destroy?.() + masonryInstance.value = null + } + // 移除监听 + 取消节流任务 + window.removeEventListener('resize', handleResize) + handleResize.cancel() }) // 仅暴露刷新方法(适配卡片内部内容变化) diff --git a/src/components/ui/button/Button.vue b/src/components/ui/button/Button.vue index 374320b..f02cfd7 100644 --- a/src/components/ui/button/Button.vue +++ b/src/components/ui/button/Button.vue @@ -1,19 +1,19 @@ diff --git a/src/components/ui/button/index.ts b/src/components/ui/button/index.ts index 26e2c55..a768c6c 100644 --- a/src/components/ui/button/index.ts +++ b/src/components/ui/button/index.ts @@ -1,38 +1,38 @@ -import type { VariantProps } from "class-variance-authority" -import { cva } from "class-variance-authority" +import type { VariantProps } from 'class-variance-authority' +import { cva } from 'class-variance-authority' -export { default as Button } from "./Button.vue" +export { default as Button } from './Button.vue' export const buttonVariants = cva( - "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", - { - variants: { - variant: { - default: - "bg-primary text-primary-foreground hover:bg-primary/90", - destructive: - "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60", - outline: - "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50", - secondary: - "bg-secondary text-secondary-foreground hover:bg-secondary/80", - ghost: - "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", - link: "text-primary underline-offset-4 hover:underline", - }, - size: { - "default": "h-9 px-4 py-2 has-[>svg]:px-3", - "sm": "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5", - "lg": "h-10 rounded-md px-6 has-[>svg]:px-4", - "icon": "size-9", - "icon-sm": "size-8", - "icon-lg": "size-10", - }, + 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=\'size-\'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive', + { + variants: { + variant: { + default: + 'bg-primary text-primary-foreground hover:bg-primary/90', + destructive: + 'bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60', + outline: + 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50', + secondary: + 'bg-secondary text-secondary-foreground hover:bg-secondary/80', + ghost: + 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50', + link: 'text-primary underline-offset-4 hover:underline', + }, + size: { + 'default': 'h-9 px-4 py-2 has-[>svg]:px-3', + 'sm': 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5', + 'lg': 'h-10 rounded-md px-6 has-[>svg]:px-4', + 'icon': 'size-9', + 'icon-sm': 'size-8', + 'icon-lg': 'size-10', + }, + }, + defaultVariants: { + variant: 'default', + size: 'default', + }, }, - defaultVariants: { - variant: "default", - size: "default", - }, - }, ) export type ButtonVariants = VariantProps diff --git a/src/components/ui/command/Command.vue b/src/components/ui/command/Command.vue index dcdf9d6..041e8c6 100644 --- a/src/components/ui/command/Command.vue +++ b/src/components/ui/command/Command.vue @@ -1,78 +1,78 @@ diff --git a/src/components/ui/command/CommandDialog.vue b/src/components/ui/command/CommandDialog.vue index 7439736..01d029f 100644 --- a/src/components/ui/command/CommandDialog.vue +++ b/src/components/ui/command/CommandDialog.vue @@ -1,15 +1,15 @@ diff --git a/src/components/ui/command/CommandInput.vue b/src/components/ui/command/CommandInput.vue index 653141e..ca4bccc 100644 --- a/src/components/ui/command/CommandInput.vue +++ b/src/components/ui/command/CommandInput.vue @@ -1,21 +1,21 @@ diff --git a/src/components/ui/command/CommandList.vue b/src/components/ui/command/CommandList.vue index 928d2f0..0b84ebc 100644 --- a/src/components/ui/command/CommandList.vue +++ b/src/components/ui/command/CommandList.vue @@ -1,13 +1,13 @@ diff --git a/src/components/ui/command/CommandSeparator.vue b/src/components/ui/command/CommandSeparator.vue index 6def19e..496ca43 100644 --- a/src/components/ui/command/CommandSeparator.vue +++ b/src/components/ui/command/CommandSeparator.vue @@ -1,13 +1,13 @@