chore: 拆分 dropdown 为 dropdown 与 dropdown-menu
This commit is contained in:
parent
d0f3b9dd70
commit
d4b4afcc0e
@ -16,9 +16,11 @@
|
|||||||
<lay-dropdown>
|
<lay-dropdown>
|
||||||
<lay-button type="primary">下拉菜单</lay-button>
|
<lay-button type="primary">下拉菜单</lay-button>
|
||||||
<template #content>
|
<template #content>
|
||||||
<lay-dropdown-item>选项一</lay-dropdown-item>
|
<lay-dropdown-menu>
|
||||||
<lay-dropdown-item>选项二</lay-dropdown-item>
|
<lay-dropdown-menu-item>选项一</lay-dropdown-menu-item>
|
||||||
<lay-dropdown-item>选项三</lay-dropdown-item>
|
<lay-dropdown-menu-item>选项二</lay-dropdown-menu-item>
|
||||||
|
<lay-dropdown-menu-item>选项三</lay-dropdown-menu-item>
|
||||||
|
</lay-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</lay-dropdown>
|
</lay-dropdown>
|
||||||
</template>
|
</template>
|
||||||
@ -46,18 +48,22 @@ export default {
|
|||||||
<lay-dropdown trigger="hover">
|
<lay-dropdown trigger="hover">
|
||||||
<lay-button>Hover 触发</lay-button>
|
<lay-button>Hover 触发</lay-button>
|
||||||
<template #content>
|
<template #content>
|
||||||
<lay-dropdown-item>选项一</lay-dropdown-item>
|
<lay-dropdown-menu>
|
||||||
<lay-dropdown-item>选项二</lay-dropdown-item>
|
<lay-dropdown-menu-item>选项一</lay-dropdown-menu-item>
|
||||||
<lay-dropdown-item>选项三</lay-dropdown-item>
|
<lay-dropdown-menu-item>选项二</lay-dropdown-menu-item>
|
||||||
|
<lay-dropdown-menu-item>选项三</lay-dropdown-menu-item>
|
||||||
|
</lay-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</lay-dropdown>
|
</lay-dropdown>
|
||||||
|
|
||||||
<lay-dropdown>
|
<lay-dropdown>
|
||||||
<lay-button>Click 触发</lay-button>
|
<lay-button>Click 触发</lay-button>
|
||||||
<template #content>
|
<template #content>
|
||||||
<lay-dropdown-item>选项一</lay-dropdown-item>
|
<lay-dropdown-menu>
|
||||||
<lay-dropdown-item>选项二</lay-dropdown-item>
|
<lay-dropdown-menu-item>选项一</lay-dropdown-menu-item>
|
||||||
<lay-dropdown-item>选项三</lay-dropdown-item>
|
<lay-dropdown-menu-item>选项二</lay-dropdown-menu-item>
|
||||||
|
<lay-dropdown-menu-item>选项三</lay-dropdown-menu-item>
|
||||||
|
</lay-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</lay-dropdown>
|
</lay-dropdown>
|
||||||
</template>
|
</template>
|
||||||
|
@ -98,6 +98,49 @@ export default {
|
|||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
::: title 海量数据
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: demo
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<lay-select v-model="selected">
|
||||||
|
<lay-select-option value="1" label="学习"></lay-select-option>
|
||||||
|
<lay-select-option value="3" label="运动"></lay-select-option>
|
||||||
|
<lay-select-option value="1" label="学习"></lay-select-option>
|
||||||
|
<lay-select-option value="3" label="运动"></lay-select-option>
|
||||||
|
<lay-select-option value="1" label="学习"></lay-select-option>
|
||||||
|
<lay-select-option value="3" label="运动"></lay-select-option>
|
||||||
|
<lay-select-option value="1" label="学习"></lay-select-option>
|
||||||
|
<lay-select-option value="3" label="运动"></lay-select-option>
|
||||||
|
<lay-select-option value="1" label="学习"></lay-select-option>
|
||||||
|
<lay-select-option value="3" label="运动"></lay-select-option>
|
||||||
|
<lay-select-option value="1" label="学习"></lay-select-option>
|
||||||
|
<lay-select-option value="3" label="运动"></lay-select-option>
|
||||||
|
<lay-select-option value="1" label="学习"></lay-select-option>
|
||||||
|
<lay-select-option value="3" label="运动"></lay-select-option>
|
||||||
|
<lay-select-option value="1" label="学习"></lay-select-option>
|
||||||
|
<lay-select-option value="3" label="运动"></lay-select-option>
|
||||||
|
</lay-select>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
setup() {
|
||||||
|
|
||||||
|
const selected = ref('1')
|
||||||
|
|
||||||
|
return {
|
||||||
|
selected
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
::: title 多选使用
|
::: title 多选使用
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
<li>[新增] table 表格组件 excel 导出工具栏。</li>
|
<li>[新增] table 表格组件 excel 导出工具栏。</li>
|
||||||
<li>[新增] table column 选项 sort 属性, 开启字段排序。</li>
|
<li>[新增] table column 选项 sort 属性, 开启字段排序。</li>
|
||||||
<li>[新增] page 分页组件 v-model 属性, 支持默认页设置。</li>
|
<li>[新增] page 分页组件 v-model 属性, 支持默认页设置。</li>
|
||||||
|
<li>[新增] dropdown-menu 与 dropdown-menu-item 下拉菜单组件。</li>
|
||||||
<li>[新增] date-picker 日期选择组件, 支持年月, 日期, 时间。</li>
|
<li>[新增] date-picker 日期选择组件, 支持年月, 日期, 时间。</li>
|
||||||
<li>[新增] transfer 穿梭框组件 showSearch 开启搜索属性。</li>
|
<li>[新增] transfer 穿梭框组件 showSearch 开启搜索属性。</li>
|
||||||
<li>[修复] carousel-item 轮播项使用 v-for 无法渲染。</li>
|
<li>[修复] carousel-item 轮播项使用 v-for 无法渲染。</li>
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.layui-dropdown dl > .layui-dropdown-menu {
|
.layui-dropdown dl > .layui-dropdown-menu {
|
||||||
border: 1px solid @global-neutral-color-3;
|
border: 1px solid #e4e7ed;
|
||||||
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
|
||||||
border-radius: @global-border-radius;
|
border-radius: @global-border-radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,34 +44,17 @@ defineExpose({ open, hide, toggle });
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="trigger === 'click'"
|
|
||||||
ref="dropdownRef"
|
ref="dropdownRef"
|
||||||
class="layui-dropdown"
|
class="layui-dropdown"
|
||||||
:class="[openState ? 'layui-dropdown-up' : '']"
|
@mouseenter="trigger === 'hover' && open()"
|
||||||
|
@mouseleave="trigger === 'hover' && hide()"
|
||||||
|
:class="{'layui-dropdown-up' : openState}"
|
||||||
>
|
>
|
||||||
<div @click="toggle">
|
<div @click="trigger === 'click' && toggle()">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
<dl class="layui-anim layui-anim-upbit">
|
<dl class="layui-anim layui-anim-upbit">
|
||||||
<ul class="layui-menu layui-dropdown-menu">
|
<slot name="content"></slot>
|
||||||
<slot name="content"></slot>
|
|
||||||
</ul>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-if="trigger === 'hover'"
|
|
||||||
class="layui-dropdown"
|
|
||||||
:class="[openState ? 'layui-dropdown-up' : '']"
|
|
||||||
@mouseenter="open"
|
|
||||||
@mouseleave="hide"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<slot></slot>
|
|
||||||
</div>
|
|
||||||
<dl class="layui-anim layui-anim-upbit">
|
|
||||||
<ul class="layui-menu layui-dropdown-menu">
|
|
||||||
<slot name="content"></slot>
|
|
||||||
</ul>
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
11
src/component/dropdownMenu/index.vue
Normal file
11
src/component/dropdownMenu/index.vue
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<template>
|
||||||
|
<ul class="layui-menu layui-dropdown-menu">
|
||||||
|
<slot></slot>
|
||||||
|
</ul>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: "LayDropdownMenu"
|
||||||
|
}
|
||||||
|
</script>
|
8
src/component/dropdownMenuItem/index.ts
Normal file
8
src/component/dropdownMenuItem/index.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import type { App } from "vue";
|
||||||
|
import Component from "./index.vue";
|
||||||
|
|
||||||
|
Component.install = (app: App) => {
|
||||||
|
app.component(Component.name, Component);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Component;
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: "LayDropdownItem",
|
name: "LayDropdownMenuItem",
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -17,6 +17,7 @@ import {
|
|||||||
toRefs,
|
toRefs,
|
||||||
Ref,
|
Ref,
|
||||||
} from "vue";
|
} from "vue";
|
||||||
|
import LayScroll from "../scroll";
|
||||||
import { onClickOutside } from "@vueuse/core";
|
import { onClickOutside } from "@vueuse/core";
|
||||||
import { SelectItem } from "../../types";
|
import { SelectItem } from "../../types";
|
||||||
|
|
||||||
@ -141,8 +142,8 @@ const selectItemPush = function (p: SelectItem) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
provide("selectItemHandle", selectItemHandle);
|
provide("selectItemHandle", selectItemHandle);
|
||||||
provide("selectItem", selectItem);
|
|
||||||
provide("selectItemPush", selectItemPush);
|
provide("selectItemPush", selectItemPush);
|
||||||
|
provide("selectItem", selectItem);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -210,12 +211,14 @@ provide("selectItemPush", selectItemPush);
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 下拉内容 -->
|
||||||
<dl class="layui-anim layui-anim-upbit">
|
<dl class="layui-anim layui-anim-upbit">
|
||||||
<!-- 多选不支持空提示 -->
|
|
||||||
<template v-if="!multiple && showEmpty">
|
<template v-if="!multiple && showEmpty">
|
||||||
<lay-select-option :value="null" :label="emptyMessage ?? placeholder" />
|
<lay-select-option :value="null" :label="emptyMessage ?? placeholder" />
|
||||||
</template>
|
</template>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -54,7 +54,8 @@ import LayEmpty from "./component/empty/index";
|
|||||||
import LayFormItem from "./component/formItem/index";
|
import LayFormItem from "./component/formItem/index";
|
||||||
import LayRate from "./component/rate/index";
|
import LayRate from "./component/rate/index";
|
||||||
import LayDropdown from "./component/dropdown/index";
|
import LayDropdown from "./component/dropdown/index";
|
||||||
import LayDropdownItem from "./component/dropdownItem/index";
|
import LayDropdownMenu from "./component/dropdownMenu/index";
|
||||||
|
import LayDropdownMenuItem from "./component/dropdownMenuItem/index";
|
||||||
import LayTab from "./component/tab/index";
|
import LayTab from "./component/tab/index";
|
||||||
import LayTabItem from "./component/tabItem/index";
|
import LayTabItem from "./component/tabItem/index";
|
||||||
import LayTree from "./component/tree/index";
|
import LayTree from "./component/tree/index";
|
||||||
@ -129,7 +130,8 @@ const components: Record<string, Component> = {
|
|||||||
LayFormItem,
|
LayFormItem,
|
||||||
LayRate,
|
LayRate,
|
||||||
LayDropdown,
|
LayDropdown,
|
||||||
LayDropdownItem,
|
LayDropdownMenu,
|
||||||
|
LayDropdownMenuItem,
|
||||||
LayTab,
|
LayTab,
|
||||||
LayTabItem,
|
LayTabItem,
|
||||||
LayIconPicker,
|
LayIconPicker,
|
||||||
@ -214,7 +216,8 @@ export {
|
|||||||
LayFormItem,
|
LayFormItem,
|
||||||
LayRate,
|
LayRate,
|
||||||
LayDropdown,
|
LayDropdown,
|
||||||
LayDropdownItem,
|
LayDropdownMenu,
|
||||||
|
LayDropdownMenuItem,
|
||||||
LayTab,
|
LayTab,
|
||||||
LayTabItem,
|
LayTabItem,
|
||||||
LayIconPicker,
|
LayIconPicker,
|
||||||
|
Loading…
Reference in New Issue
Block a user