mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 添加常用组件、composables函数
This commit is contained in:
@ -2,20 +2,25 @@
|
||||
<n-dropdown :options="options" @select="handleDropdown">
|
||||
<hover-container class="px-12px">
|
||||
<img :src="avatar" class="w-32px h-32px" />
|
||||
<span class="pl-8px text-16px font-medium">Soybean</span>
|
||||
<span class="pl-8px text-16px font-medium">{{ auth.userInfo.userName }}</span>
|
||||
</hover-container>
|
||||
</n-dropdown>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
import { NDropdown, useDialog } from 'naive-ui';
|
||||
import { HoverContainer } from '@/components';
|
||||
import { useAuthStore } from '@/store';
|
||||
import { useRouterPush } from '@/composables';
|
||||
import { iconifyRender, resetAuthStorage } from '@/utils';
|
||||
import { iconifyRender } from '@/utils';
|
||||
import avatar from '@/assets/svg/avatar/avatar01.svg';
|
||||
|
||||
type DropdownKey = 'user-center' | 'logout';
|
||||
|
||||
const route = useRoute();
|
||||
const auth = useAuthStore();
|
||||
const { resetAuthState } = useAuthStore();
|
||||
const { toLogin } = useRouterPush();
|
||||
const dialog = useDialog();
|
||||
|
||||
@ -45,8 +50,10 @@ function handleDropdown(optionKey: string) {
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: () => {
|
||||
resetAuthStorage();
|
||||
toLogin();
|
||||
resetAuthState();
|
||||
if (route.meta.requiresAuth) {
|
||||
toLogin();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { SystemLogo } from '@/components';
|
||||
import { useThemeStore } from '@/store';
|
||||
import { useAppTitle, useLayoutConfig } from '@/composables';
|
||||
import { useAppInfo, useLayoutConfig } from '@/composables';
|
||||
|
||||
interface Props {
|
||||
/** 显示名字 */
|
||||
@ -18,7 +18,7 @@ interface Props {
|
||||
defineProps<Props>();
|
||||
|
||||
const theme = useThemeStore();
|
||||
const title = useAppTitle();
|
||||
const { title } = useAppInfo();
|
||||
const { headerHeight } = useLayoutConfig();
|
||||
</script>
|
||||
<style scoped></style>
|
||||
|
@ -24,7 +24,7 @@ import { useRouter, useRoute } from 'vue-router';
|
||||
import { NScrollbar, NMenu } from 'naive-ui';
|
||||
import type { MenuOption } from 'naive-ui';
|
||||
import { useThemeStore, useAppStore } from '@/store';
|
||||
import { useAppTitle } from '@/composables';
|
||||
import { useAppInfo } from '@/composables';
|
||||
import { menus } from '@/router';
|
||||
import type { GlobalMenuOption } from '@/interface';
|
||||
|
||||
@ -44,7 +44,7 @@ const route = useRoute();
|
||||
const theme = useThemeStore();
|
||||
const app = useAppStore();
|
||||
const { toggleFixedMixMenu } = useAppStore();
|
||||
const title = useAppTitle();
|
||||
const { title } = useAppInfo();
|
||||
|
||||
const childMenus = computed(() => {
|
||||
const children: MenuOption[] = [];
|
||||
|
@ -24,7 +24,7 @@ import { useRouter, useRoute } from 'vue-router';
|
||||
import { NScrollbar, NMenu } from 'naive-ui';
|
||||
import type { MenuOption } from 'naive-ui';
|
||||
import { useThemeStore, useAppStore } from '@/store';
|
||||
import { useAppTitle } from '@/composables';
|
||||
import { useAppInfo } from '@/composables';
|
||||
import { menus } from '@/router';
|
||||
import type { GlobalMenuOption } from '@/interface';
|
||||
|
||||
@ -44,7 +44,7 @@ const route = useRoute();
|
||||
const theme = useThemeStore();
|
||||
const app = useAppStore();
|
||||
const { toggleFixedMixMenu } = useAppStore();
|
||||
const title = useAppTitle();
|
||||
const { title } = useAppInfo();
|
||||
|
||||
const childMenus = computed(() => {
|
||||
const children: MenuOption[] = [];
|
||||
|
Reference in New Issue
Block a user