From 4a56b810fd019e701a5706196ab385f26c835861 Mon Sep 17 00:00:00 2001
From: Cagatay Civici
Date: Fri, 11 Sep 2020 20:52:54 +0300
Subject: [PATCH] Migrated TabView
---
src/components/tabpanel/TabPanel.vue | 8 ++++++
src/components/tabview/TabView.vue | 37 ++++++++++------------------
src/views/tabview/TabViewDemo.vue | 6 ++---
src/views/tabview/TabViewDoc.vue | 10 ++++----
4 files changed, 29 insertions(+), 32 deletions(-)
diff --git a/src/components/tabpanel/TabPanel.vue b/src/components/tabpanel/TabPanel.vue
index e9cd4745f..5ebbcc408 100755
--- a/src/components/tabpanel/TabPanel.vue
+++ b/src/components/tabpanel/TabPanel.vue
@@ -21,6 +21,14 @@ export default {
active(newValue) {
this.d_active = newValue;
}
+ },
+ mounted() {
+ if (!this.$parent.tabs.includes(this)) {
+ this.$parent.tabs.push(this);
+ }
+ },
+ beforeDestroy() {
+ this.$parent.tabs = this.$parent.tabs.filter(tab => tab !== this);
}
}
\ No newline at end of file
diff --git a/src/components/tabview/TabView.vue b/src/components/tabview/TabView.vue
index 5f3ad675f..8ac503075 100755
--- a/src/components/tabview/TabView.vue
+++ b/src/components/tabview/TabView.vue
@@ -4,7 +4,7 @@
{{tab.header}}
-
+
@@ -18,24 +18,16 @@
diff --git a/src/views/tabview/TabViewDemo.vue b/src/views/tabview/TabViewDemo.vue
index f8666dfbd..c963b1fb4 100755
--- a/src/views/tabview/TabViewDemo.vue
+++ b/src/views/tabview/TabViewDemo.vue
@@ -82,7 +82,7 @@
Custom Headers
-
+
Header I
@@ -91,7 +91,7 @@
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
-
+
Header II
@@ -100,7 +100,7 @@
voluptatem sequi nesciunt. Consectetur, adipisci velit, sed quia non numquam eius modi.
-
+
Header III
diff --git a/src/views/tabview/TabViewDoc.vue b/src/views/tabview/TabViewDoc.vue
index efe023bb9..0e84e104b 100755
--- a/src/views/tabview/TabViewDoc.vue
+++ b/src/views/tabview/TabViewDoc.vue
@@ -76,14 +76,14 @@ import TabPanel from 'primevue/tabpanel';
<TabView class="tabview-custom">
<TabPanel>
- <template slot="header">
+ <template #header>
<i class="pi pi-calendar"></i>
<span>Header I</span>
</template>
Content I
</TabPanel>
<TabPanel>
- <template slot="header">
+ <template #header>
<span>Header II</span>
<i class="pi pi-user"></i>
</template>
@@ -310,7 +310,7 @@ export default {
<h5>Custom Headers</h5>
<TabView class="tabview-custom">
<TabPanel>
- <template slot="header">
+ <template #header>
<i class="pi pi-calendar"></i>
<span>Header I</span>
</template>
@@ -319,7 +319,7 @@ export default {
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</TabPanel>
<TabPanel>
- <template slot="header">
+ <template #header>
<span>Header II</span>
<i class="pi pi-user"></i>
</template>
@@ -328,7 +328,7 @@ export default {
voluptatem sequi nesciunt. Consectetur, adipisci velit, sed quia non numquam eius modi.</p>
</TabPanel>
<TabPanel>
- <template slot="header">
+ <template #header>
<i class="pi pi-search"></i>
<span>Header III</span>
<i class="pi pi-cog"></i>