主屏容器补充异常处理, 添加分页错误提醒;调整主屏容器加载时, 对不在连续分页上添加元素的情况进行处理

This commit is contained in:
luojiahao 2022-12-12 10:27:27 +08:00
parent db7c1bddb5
commit dd79744941
1 changed files with 18 additions and 3 deletions

View File

@ -748,10 +748,25 @@ export class GaiaContainer extends StarBaseElement {
element: HTMLElement,
direction: 'front' | 'back' | 'two-way' = 'two-way'
) {
if (pagination < 0) return
if (pagination < 0) {
console.error('The pagination should be a natural number!')
return
} else if (pagination >= this.pages._limit) {
console.error(
'The pagination has exceeded the limit, pagination:',
pagination,
'. The pagination up to:',
this.pages._limit
)
return
}
let page = this.pages[pagination]
if (!page) {
page = this.addPage()!
while (pagination > this.pages.length - 1) {
page = this.addPage()!
}
if (!page) {
console.error('Append child error!')
return
@ -1488,7 +1503,7 @@ export class GaiaContainer extends StarBaseElement {
}
continueDrag() {
if (!this._dnd.active || !this._dnd.child) {
if (!this._dnd.active || !this._dnd.child || !this['drag-and-drop']) {
return
}