feat: 通知栏

This commit is contained in:
wang_fan_w 2024-04-08 00:13:27 +08:00
parent e45c665af9
commit 83786f67e5
8 changed files with 106 additions and 77 deletions

BIN
src/assets/img/my-image.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

130
src/auto-import.d.ts vendored
View File

@ -5,67 +5,79 @@
// Generated by unplugin-auto-import // Generated by unplugin-auto-import
export {} export {}
declare global { declare global {
const EffectScope: typeof import('vue')['EffectScope'] const EffectScope: (typeof import("vue"))["EffectScope"];
const computed: typeof import('vue')['computed'] const computed: (typeof import("vue"))["computed"];
const createApp: typeof import('vue')['createApp'] const createApp: (typeof import("vue"))["createApp"];
const customRef: typeof import('vue')['customRef'] const customRef: (typeof import("vue"))["customRef"];
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'] const defineAsyncComponent: (typeof import("vue"))["defineAsyncComponent"];
const defineComponent: typeof import('vue')['defineComponent'] const defineComponent: (typeof import("vue"))["defineComponent"];
const effectScope: typeof import('vue')['effectScope'] const effectScope: (typeof import("vue"))["effectScope"];
const getCurrentInstance: typeof import('vue')['getCurrentInstance'] const getCurrentInstance: (typeof import("vue"))["getCurrentInstance"];
const getCurrentScope: typeof import('vue')['getCurrentScope'] const getCurrentScope: (typeof import("vue"))["getCurrentScope"];
const h: typeof import('vue')['h'] const h: (typeof import("vue"))["h"];
const inject: typeof import('vue')['inject'] const inject: (typeof import("vue"))["inject"];
const isProxy: typeof import('vue')['isProxy'] const isProxy: (typeof import("vue"))["isProxy"];
const isReactive: typeof import('vue')['isReactive'] const isReactive: (typeof import("vue"))["isReactive"];
const isReadonly: typeof import('vue')['isReadonly'] const isReadonly: (typeof import("vue"))["isReadonly"];
const isRef: typeof import('vue')['isRef'] const isRef: (typeof import("vue"))["isRef"];
const markRaw: typeof import('vue')['markRaw'] const markRaw: (typeof import("vue"))["markRaw"];
const nextTick: typeof import('vue')['nextTick'] const nextTick: (typeof import("vue"))["nextTick"];
const onActivated: typeof import('vue')['onActivated'] const onActivated: (typeof import("vue"))["onActivated"];
const onBeforeMount: typeof import('vue')['onBeforeMount'] const onBeforeMount: (typeof import("vue"))["onBeforeMount"];
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave'] const onBeforeRouteLeave: (typeof import("vue-router"))["onBeforeRouteLeave"];
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate'] const onBeforeRouteUpdate: (typeof import("vue-router"))["onBeforeRouteUpdate"];
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount'] const onBeforeUnmount: (typeof import("vue"))["onBeforeUnmount"];
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate'] const onBeforeUpdate: (typeof import("vue"))["onBeforeUpdate"];
const onDeactivated: typeof import('vue')['onDeactivated'] const onDeactivated: (typeof import("vue"))["onDeactivated"];
const onErrorCaptured: typeof import('vue')['onErrorCaptured'] const onErrorCaptured: (typeof import("vue"))["onErrorCaptured"];
const onMounted: typeof import('vue')['onMounted'] const onMounted: (typeof import("vue"))["onMounted"];
const onRenderTracked: typeof import('vue')['onRenderTracked'] const onRenderTracked: (typeof import("vue"))["onRenderTracked"];
const onRenderTriggered: typeof import('vue')['onRenderTriggered'] const onRenderTriggered: (typeof import("vue"))["onRenderTriggered"];
const onScopeDispose: typeof import('vue')['onScopeDispose'] const onScopeDispose: (typeof import("vue"))["onScopeDispose"];
const onServerPrefetch: typeof import('vue')['onServerPrefetch'] const onServerPrefetch: (typeof import("vue"))["onServerPrefetch"];
const onUnmounted: typeof import('vue')['onUnmounted'] const onUnmounted: (typeof import("vue"))["onUnmounted"];
const onUpdated: typeof import('vue')['onUpdated'] const onUpdated: (typeof import("vue"))["onUpdated"];
const provide: typeof import('vue')['provide'] const provide: (typeof import("vue"))["provide"];
const reactive: typeof import('vue')['reactive'] const reactive: (typeof import("vue"))["reactive"];
const readonly: typeof import('vue')['readonly'] const readonly: (typeof import("vue"))["readonly"];
const ref: typeof import('vue')['ref'] const ref: (typeof import("vue"))["ref"];
const resolveComponent: typeof import('vue')['resolveComponent'] const resolveComponent: (typeof import("vue"))["resolveComponent"];
const shallowReactive: typeof import('vue')['shallowReactive'] const shallowReactive: (typeof import("vue"))["shallowReactive"];
const shallowReadonly: typeof import('vue')['shallowReadonly'] const shallowReadonly: (typeof import("vue"))["shallowReadonly"];
const shallowRef: typeof import('vue')['shallowRef'] const shallowRef: (typeof import("vue"))["shallowRef"];
const toRaw: typeof import('vue')['toRaw'] const toRaw: (typeof import("vue"))["toRaw"];
const toRef: typeof import('vue')['toRef'] const toRef: (typeof import("vue"))["toRef"];
const toRefs: typeof import('vue')['toRefs'] const toRefs: (typeof import("vue"))["toRefs"];
const toValue: typeof import('vue')['toValue'] const toValue: (typeof import("vue"))["toValue"];
const triggerRef: typeof import('vue')['triggerRef'] const triggerRef: (typeof import("vue"))["triggerRef"];
const unref: typeof import('vue')['unref'] const unref: (typeof import("vue"))["unref"];
const useAttrs: typeof import('vue')['useAttrs'] const useAttrs: (typeof import("vue"))["useAttrs"];
const useCssModule: typeof import('vue')['useCssModule'] const useCssModule: (typeof import("vue"))["useCssModule"];
const useCssVars: typeof import('vue')['useCssVars'] const useCssVars: (typeof import("vue"))["useCssVars"];
const useLink: typeof import('vue-router')['useLink'] const useLink: (typeof import("vue-router"))["useLink"];
const useRoute: typeof import('vue-router')['useRoute'] const useRoute: (typeof import("vue-router"))["useRoute"];
const useRouter: typeof import('vue-router')['useRouter'] const useRouter: (typeof import("vue-router"))["useRouter"];
const useSlots: typeof import('vue')['useSlots'] const useSlots: (typeof import("vue"))["useSlots"];
const watch: typeof import('vue')['watch'] const watch: (typeof import("vue"))["watch"];
const watchEffect: typeof import('vue')['watchEffect'] const watchEffect: (typeof import("vue"))["watchEffect"];
const watchPostEffect: typeof import('vue')['watchPostEffect'] const watchPostEffect: (typeof import("vue"))["watchPostEffect"];
const watchSyncEffect: typeof import('vue')['watchSyncEffect'] const watchSyncEffect: (typeof import("vue"))["watchSyncEffect"];
} }
// for type re-export // for type re-export
declare global { declare global {
// @ts-ignore // @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue' export type {
import('vue') Component,
ComponentPublicInstance,
ComputedRef,
ExtractDefaultPropTypes,
ExtractPropTypes,
ExtractPublicPropTypes,
InjectionKey,
PropType,
Ref,
VNode,
WritableComputedRef
} from "vue";
import("vue");
} }

9
src/components.d.ts vendored
View File

@ -5,11 +5,10 @@
// Read more: https://github.com/vuejs/core/pull/3399 // Read more: https://github.com/vuejs/core/pull/3399
export {} export {}
declare module 'vue' { declare module "vue" {
export interface GlobalComponents { export interface GlobalComponents {
IconModule: (typeof import("./components/IconModule/index.vue"))["default"] RouterLink: (typeof import("vue-router"))["RouterLink"];
RouterLink: typeof import('vue-router')['RouterLink'] RouterView: (typeof import("vue-router"))["RouterView"];
RouterView: typeof import('vue-router')['RouterView'] SvgIcon: (typeof import("./components/SvgIcon/index.vue"))["default"];
SvgIcon: typeof import('./components/SvgIcon/index.vue')['default']
} }
} }

View File

@ -1,26 +1,27 @@
<template> <template>
<a-tabs default-active-key="1"> <a-tabs :default-active-key="current" :active-key="current" @tab-click="onTab">
<a-tab-pane v-for="item in noticeData" :key="item.id"> <a-tab-pane v-for="item in noticeData" :key="item.id">
<template #title>{{ `${item.title}(${item.data.length})` }}</template> <template #title>{{ `${item.title}(${item.data.length})` }}</template>
<div class="notice" v-for="content in item.data" :key="content.id"> <div class="notice" v-for="content in item.data" :key="content.id">
<a-image width="36" height="36" fit="cover" :src="Tom" class="notice_img" /> <a-image width="36" height="36" fit="cover" :src="myImage" class="notice_img" />
<div class="content margin-left-text"> <div class="content margin-left-text">
<div> <div>
<span>{{ content.nickname }}</span> <span class="nickname">{{ content.nickname }}</span>
<span>{{ content.time }}</span> <span class="time margin-left-text">{{ content.time }}</span>
</div> </div>
<div></div> <div class="context">{{ content.content }}</div>
</div> </div>
</div> </div>
<a-empty v-if="item.data.length === 0" />
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Tom from "@/assets/img/tom.jpg"; import myImage from "@/assets/img/my-image.jpg";
const data = ref([ const data = ref([
{ id: 100, img: "", time: "1分钟前", nickname: "兔子先森", content: "一键三连" }, { id: 100, img: "", time: "1分钟前", nickname: "兔子先森", content: "一键三连" },
{ id: 120, img: "", time: "1小时前", nickname: "Crazy Cat's Eye", content: "中午吃什么?" }, { id: 120, img: "", time: "1小时前", nickname: "捷克大力士", content: "与你握手问好" },
{ id: 130, img: "", time: "2小时前", nickname: "forever", content: "forever you" } { id: 130, img: "", time: "2小时前", nickname: "forever", content: "forever you" }
]); ]);
const noticeData = ref([ const noticeData = ref([
@ -29,9 +30,13 @@ const noticeData = ref([
title: "通知", title: "通知",
data: data.value data: data.value
}, },
{ id: 2, title: "消息", data: data.value }, { id: 2, title: "消息", data: [] },
{ id: 3, title: "代办", data: [] } { id: 3, title: "代办", data: [] }
]); ]);
const current = ref<number>(1);
const onTab = (key: number) => {
current.value = key;
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -39,7 +44,6 @@ const noticeData = ref([
margin-bottom: $margin; margin-bottom: $margin;
display: flex; display: flex;
align-items: center; align-items: center;
border: 1px solid red;
.notice_img { .notice_img {
width: 36px; width: 36px;
height: 36px; height: 36px;
@ -47,7 +51,17 @@ const noticeData = ref([
} }
.content { .content {
width: 200px; width: 200px;
border: 1px solid blue; .nickname {
font-size: $font-size-body-3;
color: $color-text-2;
}
.time {
font-size: $font-size-body-1;
color: $color-text-3;
}
.context {
font-size: $font-size-body-3;
}
} }
} }
// tabsbug // tabsbug

View File

@ -74,7 +74,7 @@
<!-- 我的 --> <!-- 我的 -->
<a-dropdown trigger="hover"> <a-dropdown trigger="hover">
<div class="my_setting"> <div class="my_setting">
<a-image width="32" height="32" fit="cover" :src="Tom" class="my_image" /> <a-image width="32" height="32" fit="cover" :src="myImage" class="my_image" />
<span>admin</span> <span>admin</span>
<div class="icon_down"> <div class="icon_down">
<icon-down style="stroke-width: 3" /> <icon-down style="stroke-width: 3" />
@ -113,7 +113,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Notice from "@/layout/components/Header/components/Notice/index.vue"; import Notice from "@/layout/components/Header/components/Notice/index.vue";
import Tom from "@/assets/img/tom.jpg"; import myImage from "@/assets/img/my-image.jpg";
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,6 +1,5 @@
<template> <template>
<div> <div>
<!-- <router-view /> -->
<component :is="layouts['defaults']"></component> <component :is="layouts['defaults']"></component>
</div> </div>
</template> </template>

View File

@ -1,5 +1,6 @@
import { createRouter, createWebHashHistory } from "vue-router"; import { createRouter, createWebHashHistory } from "vue-router";
import { dynamicRoutes, staticRoutes, notFoundAndNoPower } from "@/router/route.ts"; import { dynamicRoutes, staticRoutes, notFoundAndNoPower } from "@/router/route.ts";
import { initSetRouter } from "@/router/route-output.ts";
import NProgress from "@/config/nprogress"; import NProgress from "@/config/nprogress";
/** /**
@ -21,6 +22,7 @@ export const router = createRouter({
// 路由加载前 // 路由加载前
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
NProgress.start(); // 开启进度条 NProgress.start(); // 开启进度条
initSetRouter();
next(); next();
console.log(to, from); console.log(to, from);
// if (to.path === "/login" && !sessionStorage.getItem("token")) { // if (to.path === "/login" && !sessionStorage.getItem("token")) {

View File

@ -0,0 +1,3 @@
export function initSetRouter() {
console.log("路由数据");
}