mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 12:33:03 +00:00
use pinia to create tab store
This commit is contained in:
@@ -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);
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user