初始化
This commit is contained in:
48
main.js
Normal file
48
main.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import App from './App'
|
||||
import uviewPlus from '@/uni_modules/uview-plus'
|
||||
|
||||
//写个方法,配置一下持久化插件
|
||||
const createPersistUni = () => {
|
||||
return createPersistedState({
|
||||
storage: {
|
||||
getItem: uni.getStorageSync,
|
||||
setItem: uni.setStorageSync
|
||||
}
|
||||
})
|
||||
}
|
||||
// #ifndef VUE3
|
||||
import Vue from 'vue'
|
||||
import './uni.promisify.adaptor'
|
||||
Vue.config.productionTip = false
|
||||
App.mpType = 'app'
|
||||
const app = new Vue({
|
||||
...App
|
||||
})
|
||||
app.$mount()
|
||||
// #endif
|
||||
|
||||
// #ifdef VUE3
|
||||
import { createSSRApp } from "vue";
|
||||
import * as Pinia from "pinia";
|
||||
import { createUnistorage } from "pinia-plugin-unistorage";
|
||||
// 写个方法,配置一下持久化插件
|
||||
const createPersistUni = () => {
|
||||
return createPersistedState({
|
||||
storage: {
|
||||
getItem: uni.getStorageSync,
|
||||
setItem: uni.setStorageSync
|
||||
}
|
||||
})
|
||||
}
|
||||
export function createApp() {
|
||||
const store = Pinia.createPinia()
|
||||
// 使用持久化插件
|
||||
store.use(createPersistUni());
|
||||
const app = createSSRApp(App)
|
||||
app.use(uviewPlus)
|
||||
return {
|
||||
app,
|
||||
Pinia
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
Reference in New Issue
Block a user