diff --git a/.gitignore b/.gitignore index c490e307..480e30e5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ node_modules/ dist/ example/dist/ lib/ +es/ /types/ npm-debug.log* yarn-debug.log* diff --git a/build.all.ts b/build.all.ts new file mode 100644 index 00000000..a11bd70f --- /dev/null +++ b/build.all.ts @@ -0,0 +1,40 @@ +import { UserConfigExport } from 'vite' +import vue from '@vitejs/plugin-vue' +import { resolve } from 'path' + +export default (): UserConfigExport => { + return { + publicDir: false, + resolve: { + alias: [ + { + find: '@', + replacement: resolve(__dirname, './') + } + ] + }, + plugins: [ + vue(), + ], + build: { + cssCodeSplit: false, + outDir: 'lib', + emptyOutDir: true, + lib: { + entry: resolve(__dirname, './src/index.ts'), + name: 'layui-vue', + formats: ['es'], + fileName: (name) => `index.js` + }, + rollupOptions: { + output: { + globals: { + vue: 'Vue' + }, + assetFileNames: 'index.css', + }, + external: ['vue', 'vue-router'] + } + } + } +} \ No newline at end of file diff --git a/build.es.ts b/build.es.ts new file mode 100644 index 00000000..366cf5d6 --- /dev/null +++ b/build.es.ts @@ -0,0 +1,64 @@ +import { UserConfigExport } from 'vite' +import vue from '@vitejs/plugin-vue' +import { resolve } from 'path' +import * as fs from 'fs' + +const inputDir = resolve(__dirname, './src/component') + +const inputsArray = fs.readdirSync(inputDir).filter((name) => { + const componentDir = resolve(inputDir, name) + const isDir = fs.lstatSync(componentDir).isDirectory() + return isDir && fs.readdirSync(componentDir).includes('index.ts') +}) + +const inputs = inputsArray.reduce((backObj, pkgName) => { + backObj[pkgName] = resolve(__dirname, `./src/component/${pkgName}/index.ts`) + return backObj +}, {}) + +inputs['index'] = resolve(__dirname, './src/index.ts') + +export default (): UserConfigExport => { + return { + publicDir: false, + resolve: { + alias: [ + { + find: '@', + replacement: resolve(__dirname, './') + } + ] + }, + css: { + preprocessorOptions: { + less: { + javascriptEnabled: true + } + }, + postcss: {} + }, + plugins: [vue()], + build: { + cssCodeSplit: true, + emptyOutDir: true, + outDir: 'es', + lib: { + entry: './index.ts', + formats: ['es'] + }, + rollupOptions: { + input: inputs, + output: { + globals: { + vue: 'Vue' + }, + entryFileNames: ({ name }) => { + return name === 'index' ? 'index.js' : '[name]/index.js' + }, + assetFileNames: '[name]/index.css' + }, + external: ['vue', 'vue-router'] + } + } + } +} \ No newline at end of file diff --git a/build.less.ts b/build.less.ts new file mode 100644 index 00000000..145881bf --- /dev/null +++ b/build.less.ts @@ -0,0 +1,6 @@ +/** + * merge less file + *

+ */ + + diff --git a/example/docs/zh-CN/components/animation.md b/example/docs/zh-CN/components/animation.md index 6483a4c9..996bce7f 100644 --- a/example/docs/zh-CN/components/animation.md +++ b/example/docs/zh-CN/components/animation.md @@ -71,6 +71,113 @@ export default { } } + ::: diff --git a/example/docs/zh-CN/components/avatar.md b/example/docs/zh-CN/components/avatar.md index 7a75390b..b733ec2a 100644 --- a/example/docs/zh-CN/components/avatar.md +++ b/example/docs/zh-CN/components/avatar.md @@ -4,7 +4,7 @@ ::: title 基础使用 ::: -::: demo +::: demo 使用 `lay-avatar` 标签, 创建头像 + + ::: :::title 自定义 @@ -35,7 +38,7 @@ + +::: + + +::: title 抽屉嵌套 +::: + +::: demo + + + + + +::: + +::: title 函数调用 +::: + +::: demo + + + + + +::: + +::: title 不同方向 +::: + +::: demo + + + + + +::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/exception.md b/example/docs/zh-CN/components/exception.md new file mode 100644 index 00000000..9cdc3802 --- /dev/null +++ b/example/docs/zh-CN/components/exception.md @@ -0,0 +1,145 @@ +::: anchor +::: + +::: title 401 +::: + +::: demo 使用 `lay-exception` 标签, 创建一个异常页面 + + + + + +::: + +::: title 403 +::: + +::: demo 使用 `lay-exception` 标签, 创建一个异常页面 + + + + + +::: + +::: title 404 +::: + +::: demo 使用 `lay-exception` 标签, 创建一个异常页面 + + + + + +::: + + +::: title 500 +::: + +::: demo 使用 `lay-exception` 标签, 创建一个异常页面 + + + + + +::: + +::: title Exception 属性 +::: + +::: table + +| 属性 | 描述 | 可选值 | +| ----------- | -------- | ------ | +| title | 标题 | -- | +| status | 状态 | `403` `404` `500` | +| describe | 描述信息 | -- | + +::: + +::: title Exception 插槽 +::: + +::: table + +| 属性 | 描述 | 可选值 | +| ----------- | -------- | ------ | +| action | 操作 | -- | + +::: + +::: comment +::: + +::: previousNext field +::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/grid.md b/example/docs/zh-CN/components/grid.md index 9902f799..8a82c51f 100644 --- a/example/docs/zh-CN/components/grid.md +++ b/example/docs/zh-CN/components/grid.md @@ -105,6 +105,19 @@ export default { } } + ::: @@ -136,6 +149,19 @@ export default { } } + ::: diff --git a/example/docs/zh-CN/components/icon.md b/example/docs/zh-CN/components/icon.md index 1637b994..34922dab 100644 --- a/example/docs/zh-CN/components/icon.md +++ b/example/docs/zh-CN/components/icon.md @@ -4,7 +4,7 @@ ::: title 基础使用 ::: -::: demo +::: demo 使用 `lay-icon` 标签, 创建图标组件