[新增] select option 组件

This commit is contained in:
就眠仪式 2021-10-03 00:52:06 +08:00
parent 895bed093c
commit 69878c2c42
5 changed files with 32 additions and 7 deletions

View File

@ -198,7 +198,10 @@ export default {
<template>
<lay-form>
<lay-select></lay-select>
<lay-select>
<lay-select-option>北京</lay-select-option>
<lay-select-option>济南</lay-select-option>
</lay-select>
</lay-form>
</template>

View File

@ -40,6 +40,7 @@ import LayBreadcrumb from './module/breadcrumb/index'
import LayBreadcrumbItem from './module/breadcrumbItem/index'
import LayField from './module/field/index'
import LaySelect from './module/select/index'
import LaySelectOption from './module/selectOption/index'
import LayScroll from './module/scroll/index'
const components: Record<string, IDefineComponent> = {
@ -80,7 +81,8 @@ const components: Record<string, IDefineComponent> = {
LayAvatar,
LayField,
LaySelect,
LayScroll
LayScroll,
LaySelectOption
}
const install = (app: App, options?: InstallOptions): void => {
@ -134,6 +136,7 @@ export {
LayField,
LaySelect,
LayScroll,
LaySelectOption,
install,
}

View File

@ -19,11 +19,7 @@
</div>
<dl class="layui-anim layui-anim-upbit" style="">
<dd lay-value="" class="layui-select-tips">请选择</dd>
<dd lay-value="0" class="layui-this">北京</dd>
<dd lay-value="1" class="">上海</dd>
<dd lay-value="2" class="">广州</dd>
<dd lay-value="3" class="">深圳</dd>
<dd lay-value="4" class="">杭州</dd>
<slot></slot>
</dl>
</div>
</template>

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 || 'LaySelectOption', Component)
}
export default Component as IDefineComponent

View File

@ -0,0 +1,14 @@
<template>
<dd :value="value">
<slot></slot>
</dd>
</template>
<script setup name="LaySelectOption" lang="ts">
import { defineProps } from 'vue'
const props =
defineProps<{
value?: string
}>()
</script>