1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import App from './App'
- import store from './store'
- const msg = (title, duration = 1500, mask = false, icon = 'none') => {
- //统一提示方便全局修改
- if (Boolean(title) === false) {
- return;
- }
- uni.showToast({
- title,
- duration,
- mask,
- icon
- });
- }
- const prePage = () => {
- // 获取当前页面
- let pages = getCurrentPages();
- let prePage = pages[pages.length - 2];
- // #ifdef H5
- return prePage;
- // #endif
- return prePage.$vm;
- }
- // #ifndef VUE3
- Vue.config.productionTip = false
- Vue.prototype.$store = store;
- Vue.prototype.$api = {
- msg,
- prePage
- };
- App.mpType = 'app'
- const app = new Vue({
- store,
- ...App
- })
- app.$mount()
- // #endif
- // #ifdef VUE3
- import {
- createSSRApp
- } from 'vue'
- export function createApp() {
- const app = createSSRApp(App)
- app.use(store)
- app.config.globalProperties.$api = {
- msg,
- prePage
- }
- return {
- app
- }
- }
- // #endif
|