38 lines
816 B
Vue
38 lines
816 B
Vue
![]() |
<script lang="ts" setup>
|
||
|
import { ref } from 'vue';
|
||
|
import { useRouter } from 'vue-router';
|
||
|
import { localStg } from '@/utils/storage';
|
||
|
|
||
|
const router = useRouter();
|
||
|
|
||
|
const namespaceId = ref<string>(localStg.get('namespaceId')!);
|
||
|
|
||
|
const userInfo = localStg.get('userInfo');
|
||
|
const options = ref(
|
||
|
userInfo?.namespaceIds.map(item => {
|
||
|
return { label: item.name, value: item.uniqueId };
|
||
|
})
|
||
|
);
|
||
|
|
||
|
const onChange = (value: string) => {
|
||
|
localStg.set('namespaceId', value);
|
||
|
setTimeout(() => {
|
||
|
router.go(0);
|
||
|
}, 500);
|
||
|
};
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<NSelect v-model:value="namespaceId" class="namespace-select" :options="options" @update:value="onChange" />
|
||
|
</template>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
.namespace-select {
|
||
|
width: 150px;
|
||
|
|
||
|
:deep(.n-base-selection) {
|
||
|
border-radius: 32px !important;
|
||
|
}
|
||
|
}
|
||
|
</style>
|