From fe2157de55b6f3d643da756a3f86408bcfa53a37 Mon Sep 17 00:00:00 2001 From: sight <1453017105@qq.com> Date: Thu, 11 Aug 2022 12:29:10 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D:=20=E5=B0=86=20stackblitz=20?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=8C=89=E9=9C=80?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD,=E7=94=A8=E4=BA=8E=E5=BF=AB=E9=80=9F?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=8C=89=E9=9C=80=E5=8A=A0=E8=BD=BD=E6=96=B9?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/src/component/menu/index.less | 2 +- .../src/utils/code-stackblitz.ts | 31 ++++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/package/component/src/component/menu/index.less b/package/component/src/component/menu/index.less index d07f7887..9d323c69 100644 --- a/package/component/src/component/menu/index.less +++ b/package/component/src/component/menu/index.less @@ -1,5 +1,5 @@ @import "../dropdown/index.less"; -@import "../popper/index.less" +@import "../popper/index.less"; .layui-nav .layui-show.layui-anim-upbit .layui-show.layui-anim-upbit { top: 0px; diff --git a/package/document-component/src/utils/code-stackblitz.ts b/package/document-component/src/utils/code-stackblitz.ts index 448dedb9..2795dc76 100644 --- a/package/document-component/src/utils/code-stackblitz.ts +++ b/package/document-component/src/utils/code-stackblitz.ts @@ -3,12 +3,12 @@ import stackblitzSdk from "@stackblitz/sdk"; export const mainCode = ` import { createApp } from 'vue'; import App from './App.vue'; -import Layui from '@layui/layui-vue' -import '@layui/layui-vue/lib/index.css'; import './index.css'; +// import Layui from '@layui/layui-vue' +// import '@layui/layui-vue/lib/index.css'; const app = createApp(App); -app.use(Layui); +// app.use(Layui); app.mount('#app');`; export const styleCode = `#app { padding: 20px; }`; @@ -36,11 +36,32 @@ export const stackblitzRc = ` `; export const viteConfigCode = ` + import path from 'path' import { defineConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; import vueJsx from '@vitejs/plugin-vue-jsx'; + import Components from 'unplugin-vue-components/vite'; + import AutoImport from 'unplugin-auto-import/vite'; + import { LayuiVueResolver } from 'unplugin-vue-components/resolvers'; + + const pathSrc = path.resolve(process.cwd(), 'src') + export default defineConfig({ - plugins: [vue(), vueJsx()], + plugins: [ + vue(), + vueJsx(), + AutoImport({ + // 自动导入 vue 相关函数 + imports: ['vue',], + // 自动导入 layer-vue 相关函数 + resolvers: [LayuiVueResolver()], + dts: path.resolve(pathSrc, 'auto-imports.d.ts'), + }), + Components({ + // 自动解析 layui-vue 组件 + resolvers: [LayuiVueResolver({ resolveIcons: true })], + }), + ], }); `; @@ -64,6 +85,8 @@ export const packageJSONCode = JSON.stringify( "@vue/compiler-sfc": "^3.2.0", "@vitejs/plugin-vue": "^2.3.2", "@vitejs/plugin-vue-jsx": "^1.3.10", + "unplugin-auto-import": "0.11.1", + "unplugin-vue-components": "0.22.4", }, }, null,