[新增] tab 选项卡组件

This commit is contained in:
就眠仪式
2021-10-05 19:04:06 +08:00
parent 7fc0c0dfd5
commit ca490d6430
8 changed files with 81 additions and 2 deletions

View File

@@ -46,6 +46,8 @@ import LayEmpty from './module/empty/index'
import LayFormItem from './module/formItem/index'
import LayRate from './module/rate/index'
import LayDropdown from './module/dropdown/index'
import LayTab from './module/tab/index'
import LayTabItem from './module/tabItem/index'
const components: Record<string, IDefineComponent> = {
LayRadio,
@@ -90,7 +92,9 @@ const components: Record<string, IDefineComponent> = {
LayEmpty,
LayFormItem,
LayRate,
LayDropdown
LayDropdown,
LayTab,
LayTabItem
}
const install = (app: App, options?: InstallOptions): void => {
@@ -149,6 +153,8 @@ export {
LayFormItem,
LayRate,
LayDropdown,
LayTab,
LayTabItem,
install,
}

9
src/module/tab/index.ts Normal file
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 || 'LayTab', Component)
}
export default Component as IDefineComponent

25
src/module/tab/index.vue Normal file
View File

@@ -0,0 +1,25 @@
<template>
<div class="layui-tab">
<ul class="layui-tab-title">
<li class="layui-this">网站设置</li>
<li>用户管理</li>
<li>权限分配</li>
<li>商品管理</li>
<li>订单管理</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
1. 高度默认自适应也可以随意固宽
<br>2. Tab进行了响应式处理所以无需担心数量多少
</div>
<div class="layui-tab-item">内容2</div>
<div class="layui-tab-item">内容3</div>
<div class="layui-tab-item">内容4</div>
<div class="layui-tab-item">内容5</div>
</div>
</div>
</template>
<script setup name="LayTab" lang="ts">
</script>

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

View File

@@ -0,0 +1,6 @@
<template>
</template>
<script setup name="LayTabItem" lang="ts">
</script>