增加公共状态管理
This commit is contained in:
17
main.js
17
main.js
@@ -1,6 +1,12 @@
|
||||
import App from './App'
|
||||
import uviewPlus from 'uview-plus'
|
||||
|
||||
import * as Pinia from "pinia";
|
||||
import {
|
||||
createUnistorage
|
||||
} from "pinia-plugin-unistorage";
|
||||
import {
|
||||
useCommonStore
|
||||
} from '@/store/common.js'
|
||||
// #ifndef VUE3
|
||||
import Vue from 'vue'
|
||||
import './uni.promisify.adaptor'
|
||||
@@ -18,9 +24,16 @@ import {
|
||||
} from 'vue'
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
const store = Pinia.createPinia();
|
||||
store.use(createUnistorage());
|
||||
app.use(uviewPlus)
|
||||
app.use(store)
|
||||
|
||||
const $common = useCommonStore()
|
||||
$common.init()
|
||||
return {
|
||||
app
|
||||
app,
|
||||
Pinia
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
Reference in New Issue
Block a user