修复bottomNav按钮不显示的问题

master
落雨楓 2 years ago
parent b38be29d49
commit 71505565c2

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,6 +1,3 @@
/*!************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.82.0/node_modules/css-loader/dist/cjs.js!./node_modules/.pnpm/postcss-loader@7.3.0_postcss@8.4.23_webpack@5.82.0/node_modules/postcss-loader/dist/cjs.js!./node_modules/.pnpm/less-loader@11.1.0_less@4.1.3_webpack@5.82.0/node_modules/less-loader/dist/cjs.js!./src/tile/tile.less ***!
\************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
.tile-small, .tile-small,
.tile-medium, .tile-medium,
.tile-wide, .tile-wide,

File diff suppressed because one or more lines are too long

@ -74,23 +74,28 @@ export class BottomNavWidget {
let newBtnInfo = {...btnInfo, element: btnElem, proiorty: btnInfo.priority ?? 0}; let newBtnInfo = {...btnInfo, element: btnElem, proiorty: btnInfo.priority ?? 0};
let insertAfter = null; let insertBefore = null;
let insertAfterIndex = 0; let insertBeforeIndex = 0;
this.btnList.forEach((one, index) => { // asc (left to right)
if (newBtnInfo.priority > one.priority) { for (let i = this.btnList.length - 1; i >= 0; i--) {
insertAfter = one.element; if (newBtnInfo.priority < this.btnList[i].priority) {
insertAfterIndex = index; insertBefore = this.btnList[i].element;
insertBeforeIndex = i;
} else {
break;
} }
}); }
if (insertAfter) { if (insertBefore) {
this.bottomNavElem.insertAfter(btnElem, insertAfter); this.bottomNavElem.insertBefore(btnElem, insertBefore);
this.btnList = [...this.btnList.slice(0, insertAfterIndex + 1), newBtnInfo, ...this.btnList.slice(insertAfterIndex + 1)]; this.btnList = [...this.btnList.slice(0, insertBeforeIndex), newBtnInfo, ...this.btnList.slice(insertBeforeIndex)];
} else { } else {
this.bottomNavElem.prepend(btnElem); this.bottomNavElem.append(btnElem);
this.btnList.unshift(newBtnInfo); this.btnList.push(newBtnInfo);
} }
console.log(this.btnList);
return btnElem; return btnElem;
} }

Loading…
Cancel
Save