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
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useLink: typeof import('vue-router')['useLink']
const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
const EffectScope: (typeof import("vue"))["EffectScope"];
const computed: (typeof import("vue"))["computed"];
const createApp: (typeof import("vue"))["createApp"];
const customRef: (typeof import("vue"))["customRef"];
const defineAsyncComponent: (typeof import("vue"))["defineAsyncComponent"];
const defineComponent: (typeof import("vue"))["defineComponent"];
const effectScope: (typeof import("vue"))["effectScope"];
const getCurrentInstance: (typeof import("vue"))["getCurrentInstance"];
const getCurrentScope: (typeof import("vue"))["getCurrentScope"];
const h: (typeof import("vue"))["h"];
const inject: (typeof import("vue"))["inject"];
const isProxy: (typeof import("vue"))["isProxy"];
const isReactive: (typeof import("vue"))["isReactive"];
const isReadonly: (typeof import("vue"))["isReadonly"];
const isRef: (typeof import("vue"))["isRef"];
const markRaw: (typeof import("vue"))["markRaw"];
const nextTick: (typeof import("vue"))["nextTick"];
const onActivated: (typeof import("vue"))["onActivated"];
const onBeforeMount: (typeof import("vue"))["onBeforeMount"];
const onBeforeRouteLeave: (typeof import("vue-router"))["onBeforeRouteLeave"];
const onBeforeRouteUpdate: (typeof import("vue-router"))["onBeforeRouteUpdate"];
const onBeforeUnmount: (typeof import("vue"))["onBeforeUnmount"];
const onBeforeUpdate: (typeof import("vue"))["onBeforeUpdate"];
const onDeactivated: (typeof import("vue"))["onDeactivated"];
const onErrorCaptured: (typeof import("vue"))["onErrorCaptured"];
const onMounted: (typeof import("vue"))["onMounted"];
const onRenderTracked: (typeof import("vue"))["onRenderTracked"];
const onRenderTriggered: (typeof import("vue"))["onRenderTriggered"];
const onScopeDispose: (typeof import("vue"))["onScopeDispose"];
const onServerPrefetch: (typeof import("vue"))["onServerPrefetch"];
const onUnmounted: (typeof import("vue"))["onUnmounted"];
const onUpdated: (typeof import("vue"))["onUpdated"];
const provide: (typeof import("vue"))["provide"];
const reactive: (typeof import("vue"))["reactive"];
const readonly: (typeof import("vue"))["readonly"];
const ref: (typeof import("vue"))["ref"];
const resolveComponent: (typeof import("vue"))["resolveComponent"];
const shallowReactive: (typeof import("vue"))["shallowReactive"];
const shallowReadonly: (typeof import("vue"))["shallowReadonly"];
const shallowRef: (typeof import("vue"))["shallowRef"];
const toRaw: (typeof import("vue"))["toRaw"];
const toRef: (typeof import("vue"))["toRef"];
const toRefs: (typeof import("vue"))["toRefs"];
const toValue: (typeof import("vue"))["toValue"];
const triggerRef: (typeof import("vue"))["triggerRef"];
const unref: (typeof import("vue"))["unref"];
const useAttrs: (typeof import("vue"))["useAttrs"];
const useCssModule: (typeof import("vue"))["useCssModule"];
const useCssVars: (typeof import("vue"))["useCssVars"];
const useLink: (typeof import("vue-router"))["useLink"];
const useRoute: (typeof import("vue-router"))["useRoute"];
const useRouter: (typeof import("vue-router"))["useRouter"];
const useSlots: (typeof import("vue"))["useSlots"];
const watch: (typeof import("vue"))["watch"];
const watchEffect: (typeof import("vue"))["watchEffect"];
const watchPostEffect: (typeof import("vue"))["watchPostEffect"];
const watchSyncEffect: (typeof import("vue"))["watchSyncEffect"];
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue')
export type {
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
export {}
declare module 'vue' {
declare module "vue" {
export interface GlobalComponents {
IconModule: (typeof import("./components/IconModule/index.vue"))["default"]
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
SvgIcon: typeof import('./components/SvgIcon/index.vue')['default']
RouterLink: (typeof import("vue-router"))["RouterLink"];
RouterView: (typeof import("vue-router"))["RouterView"];
SvgIcon: (typeof import("./components/SvgIcon/index.vue"))["default"];
}
}

View File

@ -1,26 +1,27 @@
<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">
<template #title>{{ `${item.title}(${item.data.length})` }}</template>
<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>
<span>{{ content.nickname }}</span>
<span>{{ content.time }}</span>
<span class="nickname">{{ content.nickname }}</span>
<span class="time margin-left-text">{{ content.time }}</span>
</div>
<div></div>
<div class="context">{{ content.content }}</div>
</div>
</div>
<a-empty v-if="item.data.length === 0" />
</a-tab-pane>
</a-tabs>
</template>
<script setup lang="ts">
import Tom from "@/assets/img/tom.jpg";
import myImage from "@/assets/img/my-image.jpg";
const data = ref([
{ 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" }
]);
const noticeData = ref([
@ -29,9 +30,13 @@ const noticeData = ref([
title: "通知",
data: data.value
},
{ id: 2, title: "消息", data: data.value },
{ id: 2, title: "消息", data: [] },
{ id: 3, title: "代办", data: [] }
]);
const current = ref<number>(1);
const onTab = (key: number) => {
current.value = key;
};
</script>
<style lang="scss" scoped>
@ -39,7 +44,6 @@ const noticeData = ref([
margin-bottom: $margin;
display: flex;
align-items: center;
border: 1px solid red;
.notice_img {
width: 36px;
height: 36px;
@ -47,7 +51,17 @@ const noticeData = ref([
}
.content {
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

View File

@ -74,7 +74,7 @@
<!-- 我的 -->
<a-dropdown trigger="hover">
<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>
<div class="icon_down">
<icon-down style="stroke-width: 3" />
@ -113,7 +113,7 @@
</template>
<script setup lang="ts">
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>
<style lang="scss" scoped>

View File

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

View File

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

View File

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