diff --git a/docs/docs/zh-CN/components/empty.md b/docs/docs/zh-CN/components/empty.md new file mode 100644 index 00000000..d7f1bcff --- /dev/null +++ b/docs/docs/zh-CN/components/empty.md @@ -0,0 +1,39 @@ +::: demo + + + + + +::: + +::: demo + + + + + +::: \ No newline at end of file diff --git a/docs/src/layouts/Layout.vue b/docs/src/layouts/Layout.vue index 43b1e7d9..4a9460a7 100644 --- a/docs/src/layouts/Layout.vue +++ b/docs/src/layouts/Layout.vue @@ -83,6 +83,7 @@ export default { { id: 22, title: '表格',subTitle:"table" ,path: '/zh-CN/components/table' }, { id: 23, title: '头像',subTitle:"avatar" ,path: '/zh-CN/components/avatar' }, { id: 24, title: '字段',subTitle:"field" ,path: '/zh-CN/components/field' }, + { id: 25, title: '空',subTitle:"empty" ,path: '/zh-CN/components/empty' }, ] const selected = ref(1) diff --git a/docs/src/router/zh-CN.ts b/docs/src/router/zh-CN.ts index f2ce9033..3c6e8dd1 100644 --- a/docs/src/router/zh-CN.ts +++ b/docs/src/router/zh-CN.ts @@ -126,6 +126,11 @@ const zhCN = [ path: '/zh-CN/components/field', component: () => import('../../docs/zh-CN/components/field.md'), meta: { title: '字段' }, + }, + { + path: '/zh-CN/components/empty', + component: () => import('../../docs/zh-CN/components/empty.md'), + meta: { title: '空' }, } ], }, diff --git a/src/css/layui-vue.css b/src/css/layui-vue.css index 8c7ba4a3..04b09d82 100644 --- a/src/css/layui-vue.css +++ b/src/css/layui-vue.css @@ -39,4 +39,25 @@ .layui-avatar.layui-avatar-xs { height: 28px; width: 28px; +} + +.layui-empty{ + margin: 0 8px; + font-size: 14px; + line-height: 22px; + text-align: center; +} + +.layui-empty-image{ + height: 100px; + margin-bottom: 8px; +} + +.layui-empty-image img { + height: 100%; + margin: auto; +} + +.layui-empty-description{ + margin: 0; } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 074ccdd5..c6b4c7d7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,6 +42,7 @@ import LayField from './module/field/index' import LaySelect from './module/select/index' import LaySelectOption from './module/selectOption/index' import LayScroll from './module/scroll/index' +import LayEmpty from './module/empty/index' const components: Record = { LayRadio, @@ -82,7 +83,8 @@ const components: Record = { LayField, LaySelect, LayScroll, - LaySelectOption + LaySelectOption, + LayEmpty } const install = (app: App, options?: InstallOptions): void => { @@ -137,6 +139,7 @@ export { LaySelect, LayScroll, LaySelectOption, + LayEmpty, install, } diff --git a/src/module/empty/index.svg b/src/module/empty/index.svg new file mode 100644 index 00000000..896308b6 --- /dev/null +++ b/src/module/empty/index.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/module/empty/index.ts b/src/module/empty/index.ts new file mode 100644 index 00000000..661d5766 --- /dev/null +++ b/src/module/empty/index.ts @@ -0,0 +1,9 @@ +import type { App } from 'vue' +import Component from './index.vue' +import type { IDefineComponent } from '../type/index' + +Component.install = (app: App) => { + app.component(Component.name || 'LayEmpty', Component) +} + +export default Component as IDefineComponent \ No newline at end of file diff --git a/src/module/empty/index.vue b/src/module/empty/index.vue new file mode 100644 index 00000000..3351d8db --- /dev/null +++ b/src/module/empty/index.vue @@ -0,0 +1,21 @@ + + + diff --git a/src/module/menu/index.vue b/src/module/menu/index.vue index 542d73e4..8e6aa86f 100644 --- a/src/module/menu/index.vue +++ b/src/module/menu/index.vue @@ -9,6 +9,6 @@ import { defineProps } from 'vue' const props = defineProps<{ - tree: boolean + tree?: boolean }>()