mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-30 07:46:13 +00:00
feat: 重构前端项目结构并优化代码
refactor: 迁移前端资源文件至web目录 feat: 新增多种图标资源 style: 统一代码风格和格式化配置 docs: 更新README和文档说明 chore: 更新依赖和配置文件 fix: 修复部分类型定义和枚举 perf: 优化路由和组件加载逻辑
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
import App from './App.vue';
|
||||
import { createApp } from 'vue';
|
||||
import setupPlugins from '@/plugins';
|
||||
import { createTerminal } from 'vue-web-terminal';
|
||||
import '@styles/core/tailwind.css'; // tailwind
|
||||
import '@styles/index.scss'; // 样式
|
||||
import '@utils/sys/console.ts'; // 控制台输出内容
|
||||
import { setupErrorHandle } from './utils/sys/error-handle';
|
||||
|
||||
// 暗黑主题样式
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import 'element-plus/dist/index.css';
|
||||
// 暗黑模式自定义变量
|
||||
import '@/styles/dark/css-vars.css';
|
||||
|
||||
// 过渡动画
|
||||
import 'animate.css';
|
||||
|
||||
import { useConfigStore } from '@/store';
|
||||
|
||||
const app = createApp(App);
|
||||
// 注册插件(包含路由、store、指令、国际化等)
|
||||
app.use(setupPlugins);
|
||||
// 注册终端组件
|
||||
app.use(createTerminal());
|
||||
|
||||
// 封装设置 title 和 favicon 的函数
|
||||
const setTitleAndFavicon = async () => {
|
||||
try {
|
||||
const configStore = useConfigStore();
|
||||
// 强制从服务器获取最新配置
|
||||
await configStore.getConfig(true);
|
||||
|
||||
const webTitle = configStore.configData.sys_web_title?.config_value;
|
||||
const webFavicon = configStore.configData.sys_web_favicon?.config_value;
|
||||
const webLogo = configStore.configData.sys_web_logo?.config_value;
|
||||
|
||||
if (webTitle) {
|
||||
document.title = webTitle;
|
||||
}
|
||||
|
||||
if (webFavicon) {
|
||||
const favicon = document.querySelector('link[rel="icon"]');
|
||||
if (favicon instanceof HTMLLinkElement) {
|
||||
favicon.href = webFavicon;
|
||||
}
|
||||
}
|
||||
|
||||
if (webLogo) {
|
||||
const loadingLogo = document.querySelector('.loading-container-logo');
|
||||
if (loadingLogo instanceof HTMLImageElement) {
|
||||
loadingLogo.src = webLogo;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取配置数据失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('touchstart', function () {}, { passive: false });
|
||||
|
||||
// 错误处理
|
||||
setupErrorHandle(app);
|
||||
|
||||
app.mount('#app');
|
||||
|
||||
// 在应用挂载后执行设置逻辑
|
||||
setTitleAndFavicon();
|
||||
Reference in New Issue
Block a user