✨: 发布 1.2.8 版本
This commit is contained in:
parent
c09f4766b8
commit
3902453b7c
@ -1,24 +1,51 @@
|
|||||||
<template>
|
<template>
|
||||||
<lay-dropdown class="layui-cascader" ref="dropdownRef" :autoFitMinWidth="false" :updateAtScroll="true"
|
<lay-dropdown
|
||||||
:disabled="dropDownDisabled">
|
class="layui-cascader"
|
||||||
<lay-input v-model="displayValue" readonly suffix-icon="layui-icon-down" :placeholder="placeholder"
|
ref="dropdownRef"
|
||||||
v-if="!slots.default" :allow-clear="allowClear" @clear="onClear"></lay-input>
|
:autoFitMinWidth="false"
|
||||||
|
:updateAtScroll="true"
|
||||||
|
:disabled="dropDownDisabled"
|
||||||
|
>
|
||||||
|
<lay-input
|
||||||
|
v-model="displayValue"
|
||||||
|
readonly
|
||||||
|
suffix-icon="layui-icon-down"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
v-if="!slots.default"
|
||||||
|
:allow-clear="allowClear"
|
||||||
|
@clear="onClear"
|
||||||
|
></lay-input>
|
||||||
<slot v-else></slot>
|
<slot v-else></slot>
|
||||||
|
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="layui-cascader-panel">
|
<div class="layui-cascader-panel">
|
||||||
<template v-for="(itemCol, index) in treeData">
|
<template v-for="(itemCol, index) in treeData">
|
||||||
<lay-scroll height="180px" class="layui-cascader-menu" :key="'cascader-menu' + index"
|
<lay-scroll
|
||||||
v-if="itemCol.data.length">
|
height="180px"
|
||||||
<div class="layui-cascader-menu-item" v-for="(item, i) in itemCol.data" :key="index + i"
|
class="layui-cascader-menu"
|
||||||
@click="selectBar(item, i, index)" :class="[
|
:key="'cascader-menu' + index"
|
||||||
|
v-if="itemCol.data.length"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="layui-cascader-menu-item"
|
||||||
|
v-for="(item, i) in itemCol.data"
|
||||||
|
:key="index + i"
|
||||||
|
@click="selectBar(item, i, index)"
|
||||||
|
:class="[
|
||||||
{
|
{
|
||||||
'layui-cascader-selected': itemCol.selectIndex === i,
|
'layui-cascader-selected': itemCol.selectIndex === i,
|
||||||
},
|
},
|
||||||
]">
|
]"
|
||||||
<slot :name="item.slot" v-if="item.slot && slots[item.slot]"></slot>
|
>
|
||||||
|
<slot
|
||||||
|
:name="item.slot"
|
||||||
|
v-if="item.slot && slots[item.slot]"
|
||||||
|
></slot>
|
||||||
<template v-else>{{ item.label }}</template>
|
<template v-else>{{ item.label }}</template>
|
||||||
<i class="layui-icon layui-icon-right" v-if="item.children && item.children.length"></i>
|
<i
|
||||||
|
class="layui-icon layui-icon-right"
|
||||||
|
v-if="item.children && item.children.length"
|
||||||
|
></i>
|
||||||
</div>
|
</div>
|
||||||
</lay-scroll>
|
</lay-scroll>
|
||||||
</template>
|
</template>
|
||||||
@ -46,7 +73,7 @@ export interface LayCascaderProps {
|
|||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
onlyLastLevel?: boolean;
|
onlyLastLevel?: boolean;
|
||||||
replaceFields?: { label: string; value: string; children: string };
|
replaceFields?: { label: string; value: string; children: string };
|
||||||
allowClear?: boolean
|
allowClear?: boolean;
|
||||||
}
|
}
|
||||||
const props = withDefaults(defineProps<LayCascaderProps>(), {
|
const props = withDefaults(defineProps<LayCascaderProps>(), {
|
||||||
options: null,
|
options: null,
|
||||||
@ -230,7 +257,7 @@ const dropDownDisabled = ref(false);
|
|||||||
|
|
||||||
//清除事件
|
//清除事件
|
||||||
const onClear = () => {
|
const onClear = () => {
|
||||||
dropDownDisabled.value=true;
|
dropDownDisabled.value = true;
|
||||||
let arr = JSON.parse(JSON.stringify(treeData.value));
|
let arr = JSON.parse(JSON.stringify(treeData.value));
|
||||||
for (let index = 0; index < arr.length; index++) {
|
for (let index = 0; index < arr.length; index++) {
|
||||||
arr[index].selectIndex = null;
|
arr[index].selectIndex = null;
|
||||||
@ -242,7 +269,7 @@ const onClear = () => {
|
|||||||
treeData.value = arr;
|
treeData.value = arr;
|
||||||
emit("update:modelValue", null);
|
emit("update:modelValue", null);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
dropDownDisabled.value=false;
|
dropDownDisabled.value = false;
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -302,7 +302,20 @@ const dropdownRef = ref(null);
|
|||||||
const $emits = defineEmits(["update:modelValue"]);
|
const $emits = defineEmits(["update:modelValue"]);
|
||||||
|
|
||||||
const WEEK_NAME = ["日", "一", "二", "三", "四", "五", "六"];
|
const WEEK_NAME = ["日", "一", "二", "三", "四", "五", "六"];
|
||||||
const MONTH_NAME = ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"];
|
const MONTH_NAME = [
|
||||||
|
"1月",
|
||||||
|
"2月",
|
||||||
|
"3月",
|
||||||
|
"4月",
|
||||||
|
"5月",
|
||||||
|
"6月",
|
||||||
|
"7月",
|
||||||
|
"8月",
|
||||||
|
"9月",
|
||||||
|
"10月",
|
||||||
|
"11月",
|
||||||
|
"12月",
|
||||||
|
];
|
||||||
|
|
||||||
const hms = ref({
|
const hms = ref({
|
||||||
hh: dayjs(props.modelValue).hour(),
|
hh: dayjs(props.modelValue).hour(),
|
||||||
|
@ -371,7 +371,8 @@ export function removeNotifiyFromQueen(layerId: string) {
|
|||||||
// 间隙
|
// 间隙
|
||||||
let transOffsetTop = 15;
|
let transOffsetTop = 15;
|
||||||
// 删除项的高度
|
// 删除项的高度
|
||||||
let notifiyDom = document.getElementById(layerId)?.firstElementChild?.firstElementChild as HTMLElement;
|
let notifiyDom = document.getElementById(layerId)?.firstElementChild
|
||||||
|
?.firstElementChild as HTMLElement;
|
||||||
let offsetHeight = notifiyDom.offsetHeight;
|
let offsetHeight = notifiyDom.offsetHeight;
|
||||||
(window as any).NotifiyQueen = (window as any).NotifiyQueen || [];
|
(window as any).NotifiyQueen = (window as any).NotifiyQueen || [];
|
||||||
let notifiyQueen = (window as any).NotifiyQueen;
|
let notifiyQueen = (window as any).NotifiyQueen;
|
||||||
@ -386,11 +387,17 @@ export function removeNotifiyFromQueen(layerId: string) {
|
|||||||
// //得到需要修改的定位的Notifiy集合
|
// //得到需要修改的定位的Notifiy集合
|
||||||
let needCalculatelist = list.slice(findIndex + 1);
|
let needCalculatelist = list.slice(findIndex + 1);
|
||||||
needCalculatelist.forEach((e: { id: string }) => {
|
needCalculatelist.forEach((e: { id: string }) => {
|
||||||
let dom = document.getElementById(e.id)?.firstElementChild?.firstElementChild as HTMLElement;
|
let dom = document.getElementById(e.id)?.firstElementChild
|
||||||
|
?.firstElementChild as HTMLElement;
|
||||||
if (offsetType === "rt" || offsetType === "lt") {
|
if (offsetType === "rt" || offsetType === "lt") {
|
||||||
dom.style["top"] = parseFloat(dom.style["top"]) - transOffsetTop - offsetHeight + "px";
|
dom.style["top"] =
|
||||||
|
parseFloat(dom.style["top"]) - transOffsetTop - offsetHeight + "px";
|
||||||
} else {
|
} else {
|
||||||
let bottom = parseFloat(dom.style["top"].split(" - ")[1]) - transOffsetTop - offsetHeight; dom.style["top"] = "calc(100vh - " + bottom + "px)";
|
let bottom =
|
||||||
|
parseFloat(dom.style["top"].split(" - ")[1]) -
|
||||||
|
transOffsetTop -
|
||||||
|
offsetHeight;
|
||||||
|
dom.style["top"] = "calc(100vh - " + bottom + "px)";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
notifiyQueen.splice(index, 1); //删除
|
notifiyQueen.splice(index, 1); //删除
|
||||||
|
Loading…
x
Reference in New Issue
Block a user