bonus-ui/src/App.vue

71 lines
1.8 KiB
Vue
Raw Normal View History

2024-06-26 15:11:05 +08:00
<template>
2024-12-18 18:19:32 +08:00
<!-- 应用程序根容器 -->
2024-06-26 15:11:05 +08:00
<div id="app">
2024-12-18 18:19:32 +08:00
<!-- 路由视图组件用于显示当前路由对应的组件 -->
2024-06-26 15:11:05 +08:00
<router-view />
2024-12-18 18:19:32 +08:00
<!-- 主题选择器组件 -->
2024-06-26 15:11:05 +08:00
<theme-picker />
</div>
</template>
<script>
2024-12-18 18:19:32 +08:00
// 导入主题选择器组件
2024-06-26 15:11:05 +08:00
import ThemePicker from "@/components/ThemePicker";
2024-12-18 18:19:32 +08:00
// 导入 vuex 的 mapActions 辅助函数
2024-10-29 14:19:41 +08:00
import { mapActions } from 'vuex'
2024-12-18 18:19:32 +08:00
// 导入配置工具函数
2024-10-29 14:19:41 +08:00
import { get } from '@/utils/config'
2024-12-18 18:19:32 +08:00
// 警告通知组件(当前已注释)
2024-11-10 08:55:36 +08:00
// import AlertNotification from "@/views/warning/AlertNotification.vue";
2024-06-26 15:11:05 +08:00
export default {
2024-12-18 18:19:32 +08:00
// 组件名称
2024-06-26 15:11:05 +08:00
name: "App",
2024-12-18 18:19:32 +08:00
// 注册子组件
2024-06-26 15:11:05 +08:00
components: { ThemePicker },
2024-12-18 18:19:32 +08:00
// 组件创建时的生命周期钩子
2024-10-29 14:19:41 +08:00
created() {
2024-12-18 18:19:32 +08:00
// 获取系统配置信息
2024-10-29 14:19:41 +08:00
get();
},
2024-12-18 18:19:32 +08:00
// vue-meta 配置,用于动态设置页面标题
2024-06-26 15:11:05 +08:00
metaInfo() {
return {
2024-12-18 18:19:32 +08:00
// 从 vuex store 中获取动态标题
// 仅在启用动态标题功能时才使用 store 中的标题
2024-06-26 15:11:05 +08:00
title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
2024-12-18 18:19:32 +08:00
// 标题模板函数,用于生成最终的页面标题
2024-06-26 15:11:05 +08:00
titleTemplate: title => {
2024-12-18 18:19:32 +08:00
// 如果有具体页面标题,则拼接应用名称
// 如果没有具体页面标题,则只显示应用名称
2024-06-26 15:11:05 +08:00
return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
}
}
}
};
</script>
2024-12-18 18:19:32 +08:00
<style>
2024-12-18 18:19:32 +08:00
/* 隐藏主题选择器组件 */
2024-06-26 15:11:05 +08:00
#app .theme-picker {
display: none;
}
/* 下拉框内容换行展示 */
.vue-treeselect__option,
.vue-treeselect__label {
white-space: normal !important;
overflow: visible !important;
text-overflow: unset !important;
word-break: break-word !important;
line-height: normal !important;
}
.vue-treeselect__menu {
width: auto !important;
}
2024-06-26 15:11:05 +08:00
</style>