refactor: #7090 for TabView
parent
0252af5a20
commit
6498320863
|
@ -91,8 +91,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { UniqueComponentId } from '@primevue/core/utils';
|
import { findSingle, focus, getAttribute, getOffset, getWidth } from '@primeuix/utils/dom';
|
||||||
import { getWidth, getAttribute, findSingle, focus, getOffset } from '@primeuix/utils/dom';
|
|
||||||
import ChevronLeftIcon from '@primevue/icons/chevronleft';
|
import ChevronLeftIcon from '@primevue/icons/chevronleft';
|
||||||
import ChevronRightIcon from '@primevue/icons/chevronright';
|
import ChevronRightIcon from '@primevue/icons/chevronright';
|
||||||
import Ripple from 'primevue/ripple';
|
import Ripple from 'primevue/ripple';
|
||||||
|
@ -106,16 +105,12 @@ export default {
|
||||||
emits: ['update:activeIndex', 'tab-change', 'tab-click'],
|
emits: ['update:activeIndex', 'tab-change', 'tab-click'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
id: this.$attrs.id,
|
|
||||||
d_activeIndex: this.activeIndex,
|
d_activeIndex: this.activeIndex,
|
||||||
isPrevButtonDisabled: true,
|
isPrevButtonDisabled: true,
|
||||||
isNextButtonDisabled: false
|
isNextButtonDisabled: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$attrs.id': function (newValue) {
|
|
||||||
this.id = newValue || UniqueComponentId();
|
|
||||||
},
|
|
||||||
activeIndex(newValue) {
|
activeIndex(newValue) {
|
||||||
this.d_activeIndex = newValue;
|
this.d_activeIndex = newValue;
|
||||||
|
|
||||||
|
@ -125,7 +120,6 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
console.warn('Deprecated since v4. Use Tabs component instead.');
|
console.warn('Deprecated since v4. Use Tabs component instead.');
|
||||||
|
|
||||||
this.id = this.id || UniqueComponentId();
|
|
||||||
this.updateInkBar();
|
this.updateInkBar();
|
||||||
this.scrollable && this.updateButtonState();
|
this.scrollable && this.updateButtonState();
|
||||||
},
|
},
|
||||||
|
@ -147,10 +141,10 @@ export default {
|
||||||
return this.getTabProp(tab, 'header') || index;
|
return this.getTabProp(tab, 'header') || index;
|
||||||
},
|
},
|
||||||
getTabHeaderActionId(index) {
|
getTabHeaderActionId(index) {
|
||||||
return `${this.id}_${index}_header_action`;
|
return `${this.$id}_${index}_header_action`;
|
||||||
},
|
},
|
||||||
getTabContentId(index) {
|
getTabContentId(index) {
|
||||||
return `${this.id}_${index}_content`;
|
return `${this.$id}_${index}_content`;
|
||||||
},
|
},
|
||||||
getTabPT(tab, key, index) {
|
getTabPT(tab, key, index) {
|
||||||
const count = this.tabs.length;
|
const count = this.tabs.length;
|
||||||
|
|
Loading…
Reference in New Issue