1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- 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';
- setToastDefaultOptions({ duration: 3000 });
- // 获取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);
- app.mount('#app');
|