This commit is contained in:
xixingwl
2023-02-04 08:50:14 +08:00
commit 98cfbb0b77
89 changed files with 9508 additions and 0 deletions

33
main.js Normal file
View File

@@ -0,0 +1,33 @@
import App from './App'
import ajax from '@/common/ajax.js' // 路径需根据项目实际情况
import store from './store'
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
// Vue2挂载在 Vue 原型链上,则通过 this.$ajax 调用
Vue.prototype.$ajax = ajax
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import {
createSSRApp
} from 'vue'
export function createApp() {
const app = createSSRApp(App)
app.use(store)
// Vue3 (Options API)挂载在当前应用上app 为 createSSRApp 后的应用),也是通过 this.$ajax 调用
// 我们在写 Vue3 时更推荐用 Composition API即不挂载在实例上
app.config.globalProperties.$ajax = ajax
// 如果你在项目中有用到 nvue 页面,是无法通过 this.$ajax 调用
// 需要将请求方法添加到 uni 对象上,然后通过 uni.$ajax 调用
uni.$ajax = ajax
return {
app
}
}
// #endif