Newer
Older
KaiFengWechat / src / utils / main.js
@zhangdeliang zhangdeliang on 24 May 1 KB 初始化项目
// 兼容处理
import './compatible';

import { createApp } from 'vue';
import App from '@/App.vue';
import router from '@/router/index';
import '@/assets/less/style.less';
import 'vant/es/toast/style';
import 'animate.css/animate.min.css';
// pinia状态管理
import { createPinia } from 'pinia';
import { showSuccessToast, showFailToast } from 'vant';

// 持久化存储pinia
import piniaPluginPersist from 'pinia-plugin-persist';
const pinia = createPinia();
pinia.use(piniaPluginPersist);

const appXF = createApp(App);

// 全局方法
appXF.config.globalProperties.showSuccessToast = showSuccessToast; //toast成功提示
appXF.config.globalProperties.showFailToast = showFailToast; //toast失败提示

// import VConsole from 'vconsole';
// let vConsole = new VConsole();
// appXF.use(vConsole);

// 错误打印
appXF.config.errorHandler = (err, instance, info) => {
  // 处理错误,例如:报告给一个服务
  console.log('全局异常--', err, instance, info);

};

appXF.use(router).use(pinia).mount('#xfApp');