[新增] field 字段组件

This commit is contained in:
就眠仪式 2021-10-01 22:31:21 +08:00
parent 9cfe1c06d5
commit ba5e4ea5c7
7 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,23 @@
::: demo
<template>
<lay-field title="标题">内容</lay-field>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
return {
}
}
}
</script>
:::
| | | |
|--|--|--|
| title | 标题 | -- |

View File

@ -1,3 +1,4 @@
<br>
使用 npm 下载
```

View File

@ -82,6 +82,7 @@ export default {
{ id: 21, title: '手风琴',subTitle:"collapse" ,path: '/zh-CN/components/collapse' },
{ id: 22, title: '表格',subTitle:"table" ,path: '/zh-CN/components/table' },
{ id: 23, title: '头像',subTitle:"avatar" ,path: '/zh-CN/components/avatar' },
{ id: 23, title: '字段',subTitle:"field" ,path: '/zh-CN/components/field' },
]
const selected = ref(1)

View File

@ -121,6 +121,11 @@ const zhCN = [
path: '/zh-CN/components/avatar',
component: () => import('../../docs/zh-CN/components/avatar.md'),
meta: { title: '头像' },
},
{
path: '/zh-CN/components/field',
component: () => import('../../docs/zh-CN/components/field.md'),
meta: { title: '字段' },
}
],
},

View File

@ -38,6 +38,7 @@ import LayCheckbox from './module/checkbox/index'
import LayForm from './module/form/index'
import LayBreadcrumb from './module/breadcrumb/index'
import LayBreadcrumbItem from './module/breadcrumbItem/index'
import LayField from './module/field/index'
const components: Record<string, IDefineComponent> = {
LayRadio,
@ -74,7 +75,8 @@ const components: Record<string, IDefineComponent> = {
LayForm,
LayBreadcrumb,
LayBreadcrumbItem,
LayAvatar
LayAvatar,
LayField
}
const install = (app: App, options?: InstallOptions): void => {
@ -125,6 +127,7 @@ export {
LayBreadcrumb,
LayBreadcrumbItem,
LayAvatar,
LayField,
install,
}

View 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

View 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>