123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- import { createApp } from 'vue';
- import App from './App';
- import router from './router/index';
- import dayjs from 'dayjs';
- import 'dayjs/locale/zh-cn';
- import 'vant/lib/index.css';
- import './component-ui/index.less';
- import './styles/index.less';
- import { promisefiyPostMessage, postMessage } from './helpers/native-message';
- import { state } from './state';
- import { storage } from '@/helpers/storage';
- import { ACCESS_TOKEN } from '@/store/mutation-types';
- import { setupStore } from './store';
- import { Lazyload, setToastDefaultOptions } from 'vant';
- import useErrorLog from './hooks/useErrorLog';
- setToastDefaultOptions({ duration: 3000 });
- // import 'mobile-drag-drop/default.css';
- // import { polyfill } from 'mobile-drag-drop';
- // // 可选引入滚动行为的脚本
- // import { scrollBehaviourDragImageTranslateOverride } from 'mobile-drag-drop/scroll-behaviour';
- // // 可选的配置项
- // const options = {
- // // 使用这个选项以应用滚动行为
- // dragImageTranslateOverride: scrollBehaviourDragImageTranslateOverride
- // };
- // // 初始化polyfill
- // polyfill(options);
- // 获取token
- promisefiyPostMessage({ api: 'getToken' }).then((res: any) => {
- const content = res.content;
- if (content?.accessToken) {
- storage.set(ACCESS_TOKEN, content.tokenType + ' ' + content.accessToken);
- }
- });
- // 导航栏高度
- postMessage({ api: 'getNavHeight' }, (res: any) => {
- const { content } = res as any;
- const dpi = content.dpi || 2;
- if (content.navHeight) {
- const navHeight = content.navHeight / dpi;
- console.log(navHeight, 'navHeight');
- state.navBarHeight = navHeight;
- }
- });
- // import Vconsole from 'vconsole';
- // const vconsole = new Vconsole();
- const app = createApp(App);
- app.use(Lazyload);
- // store plugin: pinia
- setupStore(app);
- dayjs.locale('zh-ch');
- app.use(router);
- // 监听错误信息
- const errorLog = useErrorLog();
- errorLog.startListenErrorLog();
- app.mount('#app');
|