删除多余代码
This commit is contained in:
@@ -154,7 +154,7 @@ const extractTitleFromLineName = (lineName: string): string => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 更新指定角落数据的函数
|
// 更新指定角落数据的函数
|
||||||
const updateCornerData = (cornerIndex: number, dataItem: any, elementId: string, lineName: string) => {
|
const updateCornerData = (cornerIndex: number, elementId: string, lineName: string) => {
|
||||||
// 更新标题为传入的 lineName 的最后一部分
|
// 更新标题为传入的 lineName 的最后一部分
|
||||||
corners.value[cornerIndex].title = extractTitleFromLineName(lineName)
|
corners.value[cornerIndex].title = extractTitleFromLineName(lineName)
|
||||||
|
|
||||||
@@ -185,28 +185,12 @@ const showNextCorner = (elementId: string, lineName: string) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// // 确保 props.eventList 是数组并且过滤掉 null/undefined 元素
|
|
||||||
// if (!Array.isArray(props.eventList)) {
|
|
||||||
// console.warn('props.eventList 不是数组格式:', props.eventList)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 过滤掉 null 和 undefined 元素,然后查找匹配项
|
|
||||||
// const validItems = props.eventList.filter(item => item !== null && item !== undefined)
|
|
||||||
// const dataItem = validItems.find(item => item.lineId === elementId)
|
|
||||||
|
|
||||||
// // 如果没有找到匹配的数据项,则不更新数据
|
|
||||||
// if (!dataItem) {
|
|
||||||
// console.warn('未找到匹配的数据项:', elementId)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 查找一个未显示的角落
|
// 查找一个未显示的角落
|
||||||
const availableCornerIndex = corners.value.findIndex(corner => !corner.show)
|
const availableCornerIndex = corners.value.findIndex(corner => !corner.show)
|
||||||
|
|
||||||
if (availableCornerIndex !== -1) {
|
if (availableCornerIndex !== -1) {
|
||||||
// 有空闲角落,显示在该角落
|
// 有空闲角落,显示在该角落
|
||||||
updateCornerData(availableCornerIndex, dataItem, elementId, lineName)
|
updateCornerData(availableCornerIndex, elementId, lineName)
|
||||||
|
|
||||||
// 记录显示顺序
|
// 记录显示顺序
|
||||||
displayOrder.value.push(availableCornerIndex)
|
displayOrder.value.push(availableCornerIndex)
|
||||||
@@ -214,7 +198,7 @@ const showNextCorner = (elementId: string, lineName: string) => {
|
|||||||
// 没有空闲角落,按顺序替换角落
|
// 没有空闲角落,按顺序替换角落
|
||||||
// 获取需要替换的角落索引(循环替换)
|
// 获取需要替换的角落索引(循环替换)
|
||||||
const replaceIndex = displayOrder.value.shift() || 0
|
const replaceIndex = displayOrder.value.shift() || 0
|
||||||
updateCornerData(replaceIndex, dataItem, elementId, lineName)
|
updateCornerData(replaceIndex, elementId, lineName)
|
||||||
// 将替换的索引重新加入队列末尾
|
// 将替换的索引重新加入队列末尾
|
||||||
displayOrder.value.push(replaceIndex)
|
displayOrder.value.push(replaceIndex)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user