primevue-mirror/components/lib/tabs/Tabs.vue

43 lines
928 B
Vue
Raw Normal View History

2024-04-19 13:51:57 +00:00
<template>
<div :class="cx('root')" v-bind="ptmi('root')">
<slot></slot>
</div>
</template>
<script>
import { UniqueComponentId } from 'primevue/utils';
import BaseTabs from './BaseTabs.vue';
export default {
name: 'Tabs',
extends: BaseTabs,
inheritAttrs: false,
emits: ['update:value'],
data() {
return {
id: this.$attrs.id,
d_value: this.value
};
},
watch: {
'$attrs.id'(newValue) {
this.id = newValue || UniqueComponentId();
},
value(newValue) {
this.d_value = newValue;
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: {
updateValue(newValue) {
if (this.d_value !== newValue) {
this.d_value = newValue;
this.$emit('update:value', newValue);
}
}
}
};
</script>