import Vue from 'vue' import App from './App' import store from './store' Vue.config.productionTip = false // 注册全局方法 Vue.prototype.getSystemInfo = function() { return new Promise((resolve, reject) => { uni.getSystemInfo({ success: resolve, fail: reject }) }) } Vue.prototype.navigateTo = function(url) { uni.navigateTo({ url }) } Vue.prototype.switchTab = function(url) { uni.switchTab({ url }) } Vue.prototype.reLaunch = function(url) { uni.reLaunch({ url }) } Vue.prototype.redirectTo = function(url) { uni.redirectTo({ url }) } Vue.prototype.goBack = function(delta = 1) { uni.navigateBack({ delta }) } Vue.prototype.$showLoading = function(text = '加载中') { uni.showLoading({ title: text, mask: false }) } Vue.prototype.$hideLoading = function() { uni.hideLoading() } // 全局字体工具 Vue.prototype.$fontSize = require('./utils/fontSize').default // 🔥 全局混入:每个页面显示时自动应用字体设置 Vue.mixin({ onShow() { // 从 Vuex 读取字体设置并应用到 DOM const scale = this.$store.state.font.fontScale if (scale && scale !== 1.0) { this.$store.dispatch('font/applyFontScale', scale) } } }) App.mpType = 'app' const app = new Vue({ store, ...App }) app.$mount()