import Vue from 'vue' import App from './App' import store from './store' // store import plugins from './plugins' // plugins import './permission' // permission import dayjs from 'dayjs' import uView from 'uni_modules/uview-ui'; import loading from '@/components/xuan-loading/xuan-loading'; import messages from './locale/index' import VueI18n from 'vue-i18n' let i18nConfig = { locale: uni.getLocale() || 'zh-Hans', messages } Vue.use(VueI18n); const i18n = new VueI18n(i18nConfig) import { setTabBarTabBar, formatNumber } from "@/config/ruoyi.js"; // 全局方法挂载 Vue.prototype.setTabBarTabBar = setTabBarTabBar Vue.prototype.formatNumber = formatNumber Vue.component('loading', loading) Vue.use(plugins) Vue.use(uView); Vue.config.productionTip = false Vue.prototype.$store = store Vue.prototype.$dayjs = dayjs; App.mpType = 'app' const app = new Vue({ i18n, ...App }) app.$mount() /** * 中文/英语/老挝语 * 语言切换 */ // 获取全部语言 import { LGC_data } from '@/config/language.js'; // 语言类型保存到全局 Vue.prototype.$languageType = LGC_data.type; // 切换语言 function LGC_swich() { let key = "English"; // 默认英语 if (!!uni.getStorageSync("LANGUAGE-CODE")) { key = uni.getStorageSync("LANGUAGE-CODE"); } else { uni.setStorageSync("LANGUAGE-CODE", key); } Vue.prototype.$languageData = LGC_data[key]; } // 切换语言 应用到全局 Vue.prototype.$LGC_swich = function() { LGC_swich(); } // 加载初始语言 LGC_swich()