refactor: ♻️ userStore 代码重构优化
Former-commit-id: ef31b8420a48a91dd2449d62fb615941d528bf24
This commit is contained in:
@@ -15,12 +15,12 @@ import { storeToRefs } from "pinia";
|
||||
|
||||
const emit = defineEmits(["change"]);
|
||||
const store = storeToRefs(useUserStoreHook());
|
||||
const { roles } = store;
|
||||
const { roles } = store.user.value;
|
||||
|
||||
const switchRoles = computed({
|
||||
get: () => roles.value[0],
|
||||
get: () => roles[0],
|
||||
set: (val) => {
|
||||
roles.value = [val];
|
||||
Object.assign(roles, [val]);
|
||||
emit("change");
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user