From 90f8703a8e2dd7fe52321b847dd225e802cc41d0 Mon Sep 17 00:00:00 2001 From: geoffrey45 Date: Sun, 6 Mar 2022 10:26:23 +0300 Subject: [PATCH] use pinia to create tab store --- src/stores/tabs.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/stores/tabs.js diff --git a/src/stores/tabs.js b/src/stores/tabs.js new file mode 100644 index 00000000..2cd79067 --- /dev/null +++ b/src/stores/tabs.js @@ -0,0 +1,21 @@ +import { defineStore } from "pinia"; +import { ref } from "vue"; + +const tablist = { + home: "home", + search: "search", + queue: "queue", +}; + +export default defineStore("tabs", { + state: () => ({ + tabs: tablist, + current: tablist.home, + }), + actions: { + changeTab(tab) { + this.current = tab; + console.log(this.current); + }, + }, +});