amber-ui/src/components/AssistantMenu.vue

41 lines
884 B
Vue
Raw Normal View History

2024-09-11 16:50:46 +00:00
<template>
2024-09-12 03:16:30 +00:00
<div v-show="!loaded">正在载入</div>
<n-list hoverable clickable v-show="loaded" class="select-none">
2024-09-11 16:50:46 +00:00
<template #header>
<div>
<span class="text-xl">切换助理</span>
</div>
</template>
<n-list-item v-for="a in assistantStore.assistants" :key="a.id">
<n-thing>
{{ a.name }}
</n-thing>
</n-list-item>
</n-list>
</template>
<script setup lang="ts">
import { useUserStore } from "../stores/user";
import { updateAll } from "../plugins/update/update";
import { useAssistantStore } from "../stores/assistants";
2024-09-12 03:16:30 +00:00
const loaded = ref(false);
2024-09-11 16:50:46 +00:00
const userStore = useUserStore();
const assistantStore = useAssistantStore();
watch(
() => userStore.logined,
(newValue, oldValue) => {
if (newValue) {
update();
}
}
);
function update() {
updateAll();
2024-09-12 03:16:30 +00:00
loaded.value = true
2024-09-11 16:50:46 +00:00
}
update();
</script>