1. 添加首页轮播图组件 ImageSlider。 2. 添加我的任务组件 MineTask,展示用户任务事项。 3. 调整首页组件结构,优化页面展示效果。 4. 更新 TypeScript 版本至 5.8.3。 5. 将 tsconfig.app.json 中的 module 修改为 ESNext,适配新的模块加载方式。 6. 在文档中强调使用 Vue3 的 `<script setup>` 语法。 7. 添加 Echarts依赖
53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
import 'amfe-flexible';
|
|
import 'core-js/stable';
|
|
import 'regenerator-runtime/runtime';
|
|
import { createApp } from 'vue';
|
|
import { createPinia } from 'pinia';
|
|
import App from './App.vue';
|
|
import router from './router';
|
|
import utils from '@/assets/js/common';
|
|
import 'core-js/stable';
|
|
import 'regenerator-runtime/runtime';
|
|
// 2. 引入组件样式
|
|
import 'vant/lib/index.css';
|
|
import '@/style/utils.scss';
|
|
import appBridge from '@/assets/js/appBridge';
|
|
import VConsole from 'vconsole';
|
|
import './assets/css/main.scss';
|
|
const app = createApp(App);
|
|
|
|
if (import.meta.env.VITE_APP_ENV !== 'production') {
|
|
const vconsole = new VConsole();
|
|
app.use(vconsole);
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
onAndroidBack: (() => void) | null;
|
|
appBridge?: any;
|
|
}
|
|
}
|
|
// 定义路由是否可以返回的判断
|
|
const routerCanGoBack = () => {
|
|
const position = router.options.history.state?.position;
|
|
return typeof position === 'number' && position > 0;
|
|
};
|
|
router.beforeEach((to, from, next) => {
|
|
if (to.query.digitalYiliToken) {
|
|
utils.setSessionStorage('xToken', to.query.digitalYiliToken);
|
|
}
|
|
// appBridge.setTitle(to.meta.title as string);
|
|
// 添加 Android 返回按钮监听方法
|
|
window.onAndroidBack = () => {
|
|
if (routerCanGoBack()) {
|
|
router.go(-1);
|
|
} else {
|
|
appBridge.navigateBack();
|
|
}
|
|
};
|
|
next();
|
|
});
|
|
app.use(createPinia());
|
|
app.use(router);
|
|
app.mount('#app');
|