Files
lilishop-ui/manager/src/App.vue
lifenlong 88fc1b0b2a refactor: 四端完成 Options API → script setup + vuex → pinia 迁移
- buyer(95) / seller(169) / im(53) / manager(280) 共 597 个组件全部从 Options API 转换为 <script setup>
- 四端 vuex 全部移除,状态管理统一迁移至 pinia 4(stores/ 目录)
- util.js 等基础设施去除 vm 首参依赖;全局属性($Message/$filters 等)在 script 内改为具名导入
- 被外部 ref 访问的公共组件均已补齐 defineExpose(清单见各端 MIGRATION-VUE3.md)
- 各端 eslint 启用 vue/component-api-style 防止新代码回退 Options API
- 四端 yarn build 全部通过;迁移约定与注意事项已更新至各端 MIGRATION-VUE3.md
2026-10-13 07:06:59 +08:00

70 lines
1.3 KiB
Vue

<template>
<div id="main" class="app-main">
<router-view />
</div>
</template>
<script setup>
import { onMounted, onUpdated } from "vue";
import { useRoute } from "vue-router";
import Cookies from "js-cookie";
import { getCategoryTree } from "@/api/goods.js";
import util from "@/libs/util";
import { getStore } from "@/libs/storage";
import { useAppStore } from "@/stores/app";
defineOptions({ name: "App" });
const route = useRoute();
const appStore = useAppStore();
onUpdated(() => {
if (!localStorage.getItem("category") && route.path !== "/login") {
getCategoryTree(0).then((res) => {
if (res.success) {
localStorage.setItem("category", JSON.stringify(res.result));
}
});
}
});
onMounted(() => {
const loggedIn = getStore("accessToken") || Cookies.get("userInfoManager");
if (loggedIn) {
util.bootstrapDynamicRoutesFromCache();
util.initRouter();
appStore.setOpenedList();
appStore.initCachePage();
}
});
</script>
<style>
html,
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
background: #f0f0f0;
font-size: 14px;
}
.app-main {
width: 100%;
height: 100%;
}
.br button {
margin-right: 5px;
}
.operation button {
margin-right: 5px;
}
.tox-notifications-container {
display: none !important;
}
</style>