✨(component): update
This commit is contained in:
parent
572c5fd274
commit
1e621c4bcd
@ -10,6 +10,16 @@
|
|||||||
padding: 5px 0;
|
padding: 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layui-select .layui-icon-triangle-d {
|
||||||
|
transition: all .3s;
|
||||||
|
-webkit-transition: all .3s;
|
||||||
|
color: var(--global-neutral-color-8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.layui-select .layui-icon-triangle-d.triangle {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
.layui-select-options .layui-select-option {
|
.layui-select-options .layui-select-option {
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
line-height: 36px;
|
line-height: 36px;
|
||||||
@ -30,4 +40,7 @@
|
|||||||
|
|
||||||
.layui-select-search {
|
.layui-select-search {
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
|
.layui-input-prefix {
|
||||||
|
padding: 0 0 0 10px;
|
||||||
|
}
|
||||||
}
|
}
|
@ -6,19 +6,30 @@ export default {
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import "./index.less";
|
import "./index.less";
|
||||||
import { provide, computed, WritableComputedRef, ref, Ref, useSlots, onMounted, VNode, Component } from "vue";
|
import {
|
||||||
|
provide,
|
||||||
|
computed,
|
||||||
|
ref,
|
||||||
|
Ref,
|
||||||
|
useSlots,
|
||||||
|
onMounted,
|
||||||
|
VNode,
|
||||||
|
Component,
|
||||||
|
} from "vue";
|
||||||
import LayInput from "../input/index.vue";
|
import LayInput from "../input/index.vue";
|
||||||
import LayTagInput from "../tagInput/index.vue";
|
import LayTagInput from "../tagInput/index.vue";
|
||||||
import LayDropdown from "../dropdown/index.vue";
|
import LayDropdown from "../dropdown/index.vue";
|
||||||
import LaySelectOption, { LaySelectOptionProps } from "../selectOption/index.vue";
|
import LaySelectOption, {
|
||||||
|
LaySelectOptionProps,
|
||||||
|
} from "../selectOption/index.vue";
|
||||||
|
|
||||||
export interface LaySelectProps {
|
export interface LaySelectProps {
|
||||||
name?: string;
|
name?: string;
|
||||||
placeholder?: string;
|
create?: boolean;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
placeholder?: string;
|
||||||
modelValue?: any;
|
modelValue?: any;
|
||||||
multiple?: boolean;
|
multiple?: boolean;
|
||||||
create?: boolean;
|
|
||||||
items?: LaySelectOptionProps[];
|
items?: LaySelectOptionProps[];
|
||||||
size?: "lg" | "md" | "sm" | "xs";
|
size?: "lg" | "md" | "sm" | "xs";
|
||||||
allowClear?: boolean;
|
allowClear?: boolean;
|
||||||
@ -50,7 +61,8 @@ onMounted(() => {
|
|||||||
if (slots.default) {
|
if (slots.default) {
|
||||||
getOption(slots.default());
|
getOption(slots.default());
|
||||||
}
|
}
|
||||||
})
|
Object.assign(options.value, props.items);
|
||||||
|
});
|
||||||
|
|
||||||
const getOption = function (nodes: VNode[]) {
|
const getOption = function (nodes: VNode[]) {
|
||||||
nodes?.map((item: VNode) => {
|
nodes?.map((item: VNode) => {
|
||||||
@ -77,22 +89,21 @@ const multiple = computed(() => {
|
|||||||
return props.multiple;
|
return props.multiple;
|
||||||
});
|
});
|
||||||
|
|
||||||
provide("selectedItem", selectedItem);
|
|
||||||
provide("openState", openState);
|
provide("openState", openState);
|
||||||
|
provide("selectedItem", selectedItem);
|
||||||
provide("selectedValue", selectedValue);
|
provide("selectedValue", selectedValue);
|
||||||
provide("searchValue", searchValue);
|
provide("searchValue", searchValue);
|
||||||
provide("multiple", multiple);
|
provide("multiple", multiple);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
可选项: {{ options }}
|
|
||||||
选中值: {{ selectedValue }}
|
|
||||||
<div class="layui-select">
|
<div class="layui-select">
|
||||||
<lay-dropdown
|
<lay-dropdown
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:update-at-scroll="true"
|
:update-at-scroll="true"
|
||||||
@show="openState = true"
|
@show="openState = true"
|
||||||
@hide="openState = false">
|
@hide="openState = false"
|
||||||
|
>
|
||||||
<lay-tag-input
|
<lay-tag-input
|
||||||
v-if="multiple"
|
v-if="multiple"
|
||||||
v-model="selectedValue"
|
v-model="selectedValue"
|
||||||
@ -100,27 +111,28 @@ provide("multiple", multiple);
|
|||||||
:disabledInput="true"
|
:disabledInput="true"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<lay-icon type="layui-icon-triangle-d"></lay-icon>
|
<lay-icon type="layui-icon-triangle-d" :class="{'triangle':openState}"></lay-icon>
|
||||||
</template>
|
</template>
|
||||||
</lay-tag-input>
|
</lay-tag-input>
|
||||||
<lay-input
|
<lay-input
|
||||||
v-else
|
v-else
|
||||||
v-model="selectedValue"
|
v-model="searchValue"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:allow-clear="allowClear"
|
:allow-clear="allowClear"
|
||||||
|
:readonly="true"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<lay-icon type="layui-icon-triangle-d"></lay-icon>
|
<lay-icon type="layui-icon-triangle-d" :class="{'triangle':openState}"></lay-icon>
|
||||||
</template>
|
</template>
|
||||||
</lay-input>
|
</lay-input>
|
||||||
<template #content>
|
<template #content>
|
||||||
<dl class="layui-select-options">
|
<dl class="layui-select-options">
|
||||||
<div class="layui-select-search">
|
<div class="layui-select-search" v-if="multiple">
|
||||||
<lay-input
|
<lay-input
|
||||||
v-model="searchValue"
|
v-model="searchValue"
|
||||||
size="sm"
|
|
||||||
placeholder="请选择"
|
|
||||||
prefix-icon="layui-icon-search"
|
prefix-icon="layui-icon-search"
|
||||||
|
placeholder="请搜索"
|
||||||
|
size="sm"
|
||||||
></lay-input>
|
></lay-input>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="items">
|
<template v-if="items">
|
||||||
|
@ -52,7 +52,6 @@ const selected = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const select = () => {
|
const select = () => {
|
||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
label: props.label,
|
label: props.label,
|
||||||
value: props.value,
|
value: props.value,
|
||||||
@ -69,8 +68,7 @@ const select = () => {
|
|||||||
} else {
|
} else {
|
||||||
selectedItem.value = info;
|
selectedItem.value = info;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
|
||||||
|
|
||||||
const display = computed(() => {
|
const display = computed(() => {
|
||||||
return (
|
return (
|
||||||
|
@ -60,13 +60,8 @@ const tagData = useVModel(props, "modelValue", emit, {
|
|||||||
deep: true,
|
deep: true,
|
||||||
defaultValue: [] as TagData[],
|
defaultValue: [] as TagData[],
|
||||||
});
|
});
|
||||||
const _tagProps = reactive(props.tagProps ?? {})
|
const _tagProps = reactive(props.tagProps ?? {});
|
||||||
const tagProps = reactiveOmit(
|
const tagProps = reactiveOmit(_tagProps, "closable", "size", "disabled");
|
||||||
_tagProps,
|
|
||||||
"closable",
|
|
||||||
"size",
|
|
||||||
"disabled"
|
|
||||||
);
|
|
||||||
|
|
||||||
const computedTagData = computed(() => {
|
const computedTagData = computed(() => {
|
||||||
if (!tagData.value) return;
|
if (!tagData.value) return;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
<li>[修复] cascader 外部清空 modelValue, 选中项仍不清楚的问题。</li>
|
<li>[修复] cascader 外部清空 modelValue, 选中项仍不清楚的问题。</li>
|
||||||
<li>[修复] select 组件位于 layer 底部时, 点击时出现滚动条。</li>
|
<li>[修复] select 组件位于 layer 底部时, 点击时出现滚动条。</li>
|
||||||
<li>[修复] select 组件与 table 组件组合使用时, 下拉内容被遮盖。</li>
|
<li>[修复] select 组件与 table 组件组合使用时, 下拉内容被遮盖。</li>
|
||||||
|
<li>[修复] select 组件多选模式下提示信息错误, 将 "请选择" 调整为 "请输入"。</li>
|
||||||
<li>[优化] tag 组件 border background height 等, 使其更贴合 layui 的设计规范。</li>
|
<li>[优化] tag 组件 border background height 等, 使其更贴合 layui 的设计规范。</li>
|
||||||
<li>[优化] input 组件 suffix 插槽与 allow-clear 启用时的显示顺序, clear > suffix。</li>
|
<li>[优化] input 组件 suffix 插槽与 allow-clear 启用时的显示顺序, clear > suffix。</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user