diff --git a/components.d.ts b/components.d.ts index cabcbcf..d30b787 100644 --- a/components.d.ts +++ b/components.d.ts @@ -15,19 +15,16 @@ declare module 'vue' { MiaoLazyDiv: typeof import('./src/components/miaoLazyDiv.vue')['default'] MiaoMask: typeof import('./src/components/miaoMask.vue')['default'] MiaoPopupInput: typeof import('./src/components/miaoPopupInput.vue')['default'] - NAlert: typeof import('naive-ui')['NAlert'] NBreadcrumb: typeof import('naive-ui')['NBreadcrumb'] NBreadcrumbItem: typeof import('naive-ui')['NBreadcrumbItem'] NButton: typeof import('naive-ui')['NButton'] NCard: typeof import('naive-ui')['NCard'] - NCheckbox: typeof import('naive-ui')['NCheckbox'] NDropdown: typeof import('naive-ui')['NDropdown'] NEllipsis: typeof import('naive-ui')['NEllipsis'] NEmpty: typeof import('naive-ui')['NEmpty'] NGrid: typeof import('naive-ui')['NGrid'] NGridItem: typeof import('naive-ui')['NGridItem'] NIcon: typeof import('naive-ui')['NIcon'] - NInput: typeof import('naive-ui')['NInput'] NQrCode: typeof import('naive-ui')['NQrCode'] NScrollbar: typeof import('naive-ui')['NScrollbar'] NSpace: typeof import('naive-ui')['NSpace'] diff --git a/package.json b/package.json index c4f5665..3166183 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "build": "vue-tsc -b && vite build", "build:auto": "pnpm run build && go env -w GOOS=windows GOARCH=amd64 && rm -rf ./src-server/web/* && cp -r ./dist/* ./src-server/web/ && cd ./src-server && go env -w GOOS=windows && go build -o ../miao-directory.exe", "build:fast": "bash build.auto.release.sh -fast", + "build:normal": "bash build.auto.release.sh", "preview": "vite preview", "format": "prettier --write src/" }, diff --git a/src/plugins/miaoCrypto/export.ts b/src/plugins/miaoCrypto/_export.ts similarity index 100% rename from src/plugins/miaoCrypto/export.ts rename to src/plugins/miaoCrypto/_export.ts diff --git a/src/plugins/miaoDirectory/export.ts b/src/plugins/miaoDirectory/export.ts index aa56667..8eef82d 100644 --- a/src/plugins/miaoDirectory/export.ts +++ b/src/plugins/miaoDirectory/export.ts @@ -1,13 +1,14 @@ import { registerComponentOption } from '@/class/PluginCenter' import FileTray from '@vicons/ionicons5/es/FileTray' -// import MiaoDirectory from '@/plugins/miaoDirectory/miaoDirectory.vue' +import MiaoDirectory from '@/plugins/miaoDirectory/miaoDirectory.vue' const pluginConfig: registerComponentOption = { key: 'miaoDirectory', name: '文件夹', icon: FileTray, - getComponent: async () => - (await import('@/plugins/miaoDirectory/miaoDirectory.vue')).default, + // getComponent: async () => + // (await import('@/plugins/miaoDirectory/miaoDirectory.vue')).default, + getComponent: async () => MiaoDirectory, filter: (vDirs, vFiles) => { if (vFiles.length) { return false diff --git a/src/plugins/onnx_demo_bird/export.ts b/src/plugins/onnx_demo_bird/export.ts new file mode 100644 index 0000000..e33d51d --- /dev/null +++ b/src/plugins/onnx_demo_bird/export.ts @@ -0,0 +1,51 @@ +import { registerComponentOption } from '@/class/PluginCenter' +import VirtualDirectory, { VirtualFile } from '@/class/VirtualDirectory' +import { Analytics } from '@vicons/ionicons5' + +const pluginConfig: registerComponentOption = { + key: '45632456', + name: 'ONNX DEMO BIRD', + icon: Analytics, + getComponent: async () => + (await import('./onnx_demo.vue')).default, + filter: (_vDirs: VirtualDirectory[], vFiles: VirtualFile[]) => { + if (vFiles.length === 0) { + return false + } + + // 检查是否存在.onnx文件 + let hasOnnxFile = false + // 检查是否存在图片文件 + let hasImageFile = false + + const imageSuffixList = [ + 'xbm', 'tif', 'pjp', 'svgz', 'jpg', 'jpeg', 'ico', 'tiff', 'gif', + 'svg', 'jfif', 'webp', 'png', 'bmp', 'pjpeg', 'avif' + ] + + for (let vf of vFiles) { + if (vf.name.endsWith('.onnx')) { + hasOnnxFile = true + return true + } + + for (let end of imageSuffixList) { + if (vf.name.endsWith(end)) { + hasImageFile = true + break + } + } + + if (hasOnnxFile && hasImageFile) { + return true + } + } + + return false + } +} + +export default pluginConfig + +import { PluginExportType } from '@/types/type' +export const type = PluginExportType.component \ No newline at end of file diff --git a/src/plugins/onnx_demo_bird/onnx_demo.vue b/src/plugins/onnx_demo_bird/onnx_demo.vue new file mode 100644 index 0000000..b374ece --- /dev/null +++ b/src/plugins/onnx_demo_bird/onnx_demo.vue @@ -0,0 +1,306 @@ + + + + + \ No newline at end of file diff --git a/src/plugins/registerExternalPlugin/export.ts b/src/plugins/registerExternalPlugin/_export.ts similarity index 100% rename from src/plugins/registerExternalPlugin/export.ts rename to src/plugins/registerExternalPlugin/_export.ts diff --git a/src/utils/component2plugin.ts b/src/utils/component2plugin.ts index dfd5ec2..7279f33 100644 --- a/src/utils/component2plugin.ts +++ b/src/utils/component2plugin.ts @@ -3,6 +3,7 @@ import VirtualDirectory, { VirtualFile } from "@/class/VirtualDirectory" import VirtualPage from "@/class/VirtualPage" import usePluginCenter from "@/hooks/usePluginCenter" import useVirtualPages from "@/hooks/useVirtualPages" +import { Component } from "vue" export const componentOption2pluginOption = (option: registerComponentOption) => { const { @@ -17,7 +18,8 @@ export const componentOption2pluginOption = (option: registerComponentOption) => single = false, priority = 0 } = option - let _component: any + let _component: Component + let _componentPromise: Promise const views = useVirtualPages() const pluginCenter = usePluginCenter() return { @@ -36,13 +38,19 @@ export const componentOption2pluginOption = (option: registerComponentOption) => } if (_component === undefined) { - const setAlertTip = pluginCenter.globalAlertTip(`加载 ${name} 插件中`) - _component = await getComponent() - setAlertTip && - setAlertTip(`加载 ${name} 插件完成`, { - type: 'success', - timeout: 2000 - }) + if (_componentPromise !== undefined) { + await _componentPromise + } + else { + const setAlertTip = pluginCenter.globalAlertTip(`加载 ${name} 插件中`) + _componentPromise = getComponent() + _component = await _componentPromise + setAlertTip && + setAlertTip(`加载 ${name} 插件完成`, { + type: 'success', + timeout: 2000 + }) + } } const _findRes = views.find(_component) as VirtualPage[] if (single && _findRes.length !== 0) {