[新增] field 字段组件
This commit is contained in:
parent
9cfe1c06d5
commit
ba5e4ea5c7
23
docs/docs/zh-CN/components/field.md
Normal file
23
docs/docs/zh-CN/components/field.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
::: demo
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<lay-field title="标题">内容</lay-field>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
setup() {
|
||||||
|
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
| | | |
|
||||||
|
|--|--|--|
|
||||||
|
| title | 标题 | -- |
|
@ -1,3 +1,4 @@
|
|||||||
|
<br>
|
||||||
|
|
||||||
使用 npm 下载
|
使用 npm 下载
|
||||||
```
|
```
|
||||||
|
@ -82,6 +82,7 @@ export default {
|
|||||||
{ id: 21, title: '手风琴',subTitle:"collapse" ,path: '/zh-CN/components/collapse' },
|
{ id: 21, title: '手风琴',subTitle:"collapse" ,path: '/zh-CN/components/collapse' },
|
||||||
{ id: 22, title: '表格',subTitle:"table" ,path: '/zh-CN/components/table' },
|
{ id: 22, title: '表格',subTitle:"table" ,path: '/zh-CN/components/table' },
|
||||||
{ id: 23, title: '头像',subTitle:"avatar" ,path: '/zh-CN/components/avatar' },
|
{ id: 23, title: '头像',subTitle:"avatar" ,path: '/zh-CN/components/avatar' },
|
||||||
|
{ id: 23, title: '字段',subTitle:"field" ,path: '/zh-CN/components/field' },
|
||||||
]
|
]
|
||||||
|
|
||||||
const selected = ref(1)
|
const selected = ref(1)
|
||||||
|
@ -121,6 +121,11 @@ const zhCN = [
|
|||||||
path: '/zh-CN/components/avatar',
|
path: '/zh-CN/components/avatar',
|
||||||
component: () => import('../../docs/zh-CN/components/avatar.md'),
|
component: () => import('../../docs/zh-CN/components/avatar.md'),
|
||||||
meta: { title: '头像' },
|
meta: { title: '头像' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/zh-CN/components/field',
|
||||||
|
component: () => import('../../docs/zh-CN/components/field.md'),
|
||||||
|
meta: { title: '字段' },
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -38,6 +38,7 @@ import LayCheckbox from './module/checkbox/index'
|
|||||||
import LayForm from './module/form/index'
|
import LayForm from './module/form/index'
|
||||||
import LayBreadcrumb from './module/breadcrumb/index'
|
import LayBreadcrumb from './module/breadcrumb/index'
|
||||||
import LayBreadcrumbItem from './module/breadcrumbItem/index'
|
import LayBreadcrumbItem from './module/breadcrumbItem/index'
|
||||||
|
import LayField from './module/field/index'
|
||||||
|
|
||||||
const components: Record<string, IDefineComponent> = {
|
const components: Record<string, IDefineComponent> = {
|
||||||
LayRadio,
|
LayRadio,
|
||||||
@ -74,7 +75,8 @@ const components: Record<string, IDefineComponent> = {
|
|||||||
LayForm,
|
LayForm,
|
||||||
LayBreadcrumb,
|
LayBreadcrumb,
|
||||||
LayBreadcrumbItem,
|
LayBreadcrumbItem,
|
||||||
LayAvatar
|
LayAvatar,
|
||||||
|
LayField
|
||||||
}
|
}
|
||||||
|
|
||||||
const install = (app: App, options?: InstallOptions): void => {
|
const install = (app: App, options?: InstallOptions): void => {
|
||||||
@ -125,6 +127,7 @@ export {
|
|||||||
LayBreadcrumb,
|
LayBreadcrumb,
|
||||||
LayBreadcrumbItem,
|
LayBreadcrumbItem,
|
||||||
LayAvatar,
|
LayAvatar,
|
||||||
|
LayField,
|
||||||
install,
|
install,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
src/module/field/index.ts
Normal file
9
src/module/field/index.ts
Normal file
@ -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 || 'LayField', Component)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Component as IDefineComponent
|
15
src/module/field/index.vue
Normal file
15
src/module/field/index.vue
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<template>
|
||||||
|
<fieldset class="layui-elem-field">
|
||||||
|
<legend>{{title}}</legend>
|
||||||
|
<div class="layui-field-box">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="LayField" lang="ts">
|
||||||
|
const props =
|
||||||
|
defineProps<{
|
||||||
|
title?: string
|
||||||
|
}>()
|
||||||
|
</script>
|
Loading…
x
Reference in New Issue
Block a user