[新增] form-item 组件
This commit is contained in:
parent
8f3b104c8b
commit
2fb6d43e39
@ -24,7 +24,7 @@ export default {
|
||||
::: demo
|
||||
|
||||
<template>
|
||||
<lay-input placeholder="请输入密码"></lay-input>
|
||||
<lay-input placeholder="请输入密码" type="password"></lay-input>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -43,6 +43,7 @@ import LaySelect from './module/select/index'
|
||||
import LaySelectOption from './module/selectOption/index'
|
||||
import LayScroll from './module/scroll/index'
|
||||
import LayEmpty from './module/empty/index'
|
||||
import LayFormItem from './module/formItem/index'
|
||||
|
||||
const components: Record<string, IDefineComponent> = {
|
||||
LayRadio,
|
||||
@ -84,7 +85,8 @@ const components: Record<string, IDefineComponent> = {
|
||||
LaySelect,
|
||||
LayScroll,
|
||||
LaySelectOption,
|
||||
LayEmpty
|
||||
LayEmpty,
|
||||
LayFormItem
|
||||
}
|
||||
|
||||
const install = (app: App, options?: InstallOptions): void => {
|
||||
@ -140,6 +142,7 @@ export {
|
||||
LayScroll,
|
||||
LaySelectOption,
|
||||
LayEmpty,
|
||||
LayFormItem,
|
||||
install,
|
||||
}
|
||||
|
||||
|
@ -5,5 +5,4 @@
|
||||
</template>
|
||||
|
||||
<script setup name="LayForm" lang="ts">
|
||||
|
||||
</script>
|
||||
|
9
src/module/formItem/index.ts
Normal file
9
src/module/formItem/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 || 'LayFormItem', Component)
|
||||
}
|
||||
|
||||
export default Component as IDefineComponent
|
21
src/module/formItem/index.vue
Normal file
21
src/module/formItem/index.vue
Normal file
@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{{ label }}</label>
|
||||
<div :class="[mode ? 'layui-input-' + mode : '']" class="layui-input-block">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup name="LayFormItem" lang="ts">
|
||||
import { defineProps, withDefaults } from 'vue'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
mode?: string
|
||||
label?: string
|
||||
}>(),
|
||||
{
|
||||
mode: 'block',
|
||||
}
|
||||
)
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user