♻️(component): 清除layer.notifiy工具函数中的ts-ignore
This commit is contained in:
parent
04dd4ab102
commit
c8cadea60a
@ -450,6 +450,7 @@ const closeHandle = () => {
|
|||||||
|
|
||||||
//Notify 从队列中移除当前实例
|
//Notify 从队列中移除当前实例
|
||||||
if (type === 6) {
|
if (type === 6) {
|
||||||
|
//@ts-ignore
|
||||||
removeNotifiyFromQueen(props.id);
|
removeNotifiyFromQueen(props.id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -314,10 +314,8 @@ export function calculateNotifOffset(offset: any, area: any, layerId: string) {
|
|||||||
// 间隙
|
// 间隙
|
||||||
let transOffsetLeft = 15;
|
let transOffsetLeft = 15;
|
||||||
let transOffsetTop = 15;
|
let transOffsetTop = 15;
|
||||||
// @ts-ignore
|
(window as any).NotifiyQueen = (window as any).NotifiyQueen || [];
|
||||||
window.NotifiyQueen = window.NotifiyQueen || [];
|
let notifiyQueen = (window as any).NotifiyQueen;
|
||||||
// @ts-ignore
|
|
||||||
let notifiyQueen = window.NotifiyQueen;
|
|
||||||
if (typeof offset != "string" || arr.indexOf(offset) === -1) {
|
if (typeof offset != "string" || arr.indexOf(offset) === -1) {
|
||||||
offset = "rt";
|
offset = "rt";
|
||||||
}
|
}
|
||||||
@ -369,19 +367,14 @@ export function calculateNotifOffset(offset: any, area: any, layerId: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//移除Notify队列中某项,并且重新计算其他Notify位置
|
//移除Notify队列中某项,并且重新计算其他Notify位置
|
||||||
export function removeNotifiyFromQueen(layerId: string | undefined) {
|
export function removeNotifiyFromQueen(layerId: string) {
|
||||||
// 间隙
|
// 间隙
|
||||||
let transOffsetTop = 15;
|
let transOffsetTop = 15;
|
||||||
// @ts-ignore 删除项的高度
|
// 删除项的高度
|
||||||
let offsetHeight =
|
let notifiyDom = document.getElementById(layerId)?.firstElementChild?.firstElementChild as HTMLElement;
|
||||||
// @ts-ignore
|
let offsetHeight = notifiyDom.offsetHeight;
|
||||||
// @ts-ignore
|
(window as any).NotifiyQueen = (window as any).NotifiyQueen || [];
|
||||||
document.getElementById(layerId)?.firstElementChild?.firstElementChild
|
let notifiyQueen = (window as any).NotifiyQueen;
|
||||||
?.offsetHeight;
|
|
||||||
// @ts-ignore
|
|
||||||
window.NotifiyQueen = window.NotifiyQueen || [];
|
|
||||||
// @ts-ignore
|
|
||||||
let notifiyQueen = window.NotifiyQueen;
|
|
||||||
let index = notifiyQueen.findIndex((e: { id: string }) => e.id === layerId);
|
let index = notifiyQueen.findIndex((e: { id: string }) => e.id === layerId);
|
||||||
let offsetType = notifiyQueen[index].offset;
|
let offsetType = notifiyQueen[index].offset;
|
||||||
let list = notifiyQueen.filter((e: { offset: any }) => {
|
let list = notifiyQueen.filter((e: { offset: any }) => {
|
||||||
@ -393,22 +386,11 @@ export function removeNotifiyFromQueen(layerId: string | undefined) {
|
|||||||
// //得到需要修改的定位的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
|
let dom = document.getElementById(e.id)?.firstElementChild?.firstElementChild as HTMLElement;
|
||||||
?.firstElementChild;
|
|
||||||
if (offsetType === "rt" || offsetType === "lt") {
|
if (offsetType === "rt" || offsetType === "lt") {
|
||||||
// @ts-ignore
|
dom.style["top"] = parseFloat(dom.style["top"]) - transOffsetTop - offsetHeight + "px";
|
||||||
dom.style["top"] =
|
|
||||||
// @ts-ignore
|
|
||||||
parseFloat(dom.style["top"]) - transOffsetTop - offsetHeight + "px";
|
|
||||||
} else {
|
} else {
|
||||||
// @ts-ignore
|
let bottom = parseFloat(dom.style["top"].split(" - ")[1]) - transOffsetTop - offsetHeight; dom.style["top"] = "calc(100vh - " + bottom + "px)";
|
||||||
let bottom =
|
|
||||||
// @ts-ignore
|
|
||||||
parseFloat(dom.style["top"].split(" - ")[1]) -
|
|
||||||
transOffsetTop -
|
|
||||||
offsetHeight;
|
|
||||||
// @ts-ignore
|
|
||||||
dom.style["top"] = "calc(100vh - " + bottom + "px)";
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
notifiyQueen.splice(index, 1); //删除
|
notifiyQueen.splice(index, 1); //删除
|
||||||
|
Loading…
Reference in New Issue
Block a user