From 4d682c2ac61c48c43991e838d0090db12053aa91 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Tue, 26 Dec 2023 04:21:46 +0800 Subject: [PATCH] Proof of concept - Vue Polling - Performance Improvement and tweaking for better user experience --- .../AdminPaymentsBillingSectionComponent.vue | 25 ++++++++++++------- .../assets/vue/general/mixins/tabHandler.js | 24 ++++++++++++++++++ 2 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 resources/assets/vue/general/mixins/tabHandler.js diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index bda36503..ee91d849 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -6,7 +6,7 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -128,7 +128,14 @@ diff --git a/resources/assets/vue/general/mixins/tabHandler.js b/resources/assets/vue/general/mixins/tabHandler.js new file mode 100644 index 00000000..81790ed0 --- /dev/null +++ b/resources/assets/vue/general/mixins/tabHandler.js @@ -0,0 +1,24 @@ +export default { + data() { + return { + activeTab: null, + displayedTabs: [], + }; + }, + methods: { + setActiveTab(event) { + const tabName = event.currentTarget.getAttribute('tab-name'); + // console.log(`Tab "${tabName}" clicked`); + this.activeTab = tabName; + if (!this.displayedTabs.includes(tabName)) { + this.displayedTabs.push(tabName); + } + }, + isActiveTab(tabName) { + return this.activeTab === tabName; + }, + showTabContent(tabName) { + return this.displayedTabs.includes(tabName); + }, + }, +}