Refactor #5621
parent
38b4683485
commit
866643ef2b
|
@ -113,16 +113,26 @@ export default {
|
||||||
const { content, inkbar, tabs } = this.$refs;
|
const { content, inkbar, tabs } = this.$refs;
|
||||||
const activeTab = DomHandler.findSingle(content, '[data-pc-name="tab"][data-p-active="true"]');
|
const activeTab = DomHandler.findSingle(content, '[data-pc-name="tab"][data-p-active="true"]');
|
||||||
|
|
||||||
inkbar.style.width = DomHandler.getOuterWidth(activeTab) + 'px';
|
if (this.$pcTabs.isVertical()) {
|
||||||
inkbar.style.left = DomHandler.getOffset(activeTab).left - DomHandler.getOffset(tabs).left + 'px';
|
inkbar.style.height = DomHandler.getOuterHeight(activeTab) + 'px';
|
||||||
|
inkbar.style.top = DomHandler.getOffset(activeTab).top - DomHandler.getOffset(tabs).top + 'px';
|
||||||
|
} else {
|
||||||
|
inkbar.style.width = DomHandler.getOuterWidth(activeTab) + 'px';
|
||||||
|
inkbar.style.left = DomHandler.getOffset(activeTab).left - DomHandler.getOffset(tabs).left + 'px';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
updateButtonState() {
|
updateButtonState() {
|
||||||
const { list, content } = this.$refs;
|
const { list, content } = this.$refs;
|
||||||
const { scrollLeft, scrollWidth, offsetWidth } = content;
|
const { scrollLeft, scrollTop, scrollWidth, scrollHeight, offsetWidth, offsetHeight } = content;
|
||||||
const width = DomHandler.getWidth(content);
|
const [width, height] = [DomHandler.getWidth(content), DomHandler.getHeight(content)];
|
||||||
|
|
||||||
this.isPrevButtonEnabled = scrollLeft !== 0;
|
if (this.$pcTabs.isVertical()) {
|
||||||
this.isNextButtonEnabled = list.offsetWidth >= offsetWidth && parseInt(scrollLeft) !== scrollWidth - width;
|
this.isPrevButtonEnabled = scrollTop !== 0;
|
||||||
|
this.isNextButtonEnabled = list.offsetHeight >= offsetHeight && parseInt(scrollTop) !== scrollHeight - height;
|
||||||
|
} else {
|
||||||
|
this.isPrevButtonEnabled = scrollLeft !== 0;
|
||||||
|
this.isNextButtonEnabled = list.offsetWidth >= offsetWidth && parseInt(scrollLeft) !== scrollWidth - width;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getVisibleButtonWidths() {
|
getVisibleButtonWidths() {
|
||||||
const { prevBtn, nextBtn } = this.$refs;
|
const { prevBtn, nextBtn } = this.$refs;
|
||||||
|
|
|
@ -36,6 +36,9 @@ export default {
|
||||||
this.d_value = newValue;
|
this.d_value = newValue;
|
||||||
this.$emit('update:value', newValue);
|
this.$emit('update:value', newValue);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
isVertical() {
|
||||||
|
return this.orientation === 'vertical';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue