| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import App from './App'
- // #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 { createPinia } from 'pinia'
- import { createPersistedState } from 'pinia-plugin-persistedstate'
- export function createApp() {
- const app = createSSRApp(App)
-
- // 创建pinia实例
- const pinia = createPinia()
-
- // 配置持久化插件
- pinia.use(createPersistedState({
- storage: {
- getItem(key) {
- return uni.getStorageSync(key)
- },
- setItem(key, value) {
- uni.setStorageSync(key, value)
- }
- }
- }))
-
- app.use(pinia)
-
- return {
- app
- }
- }
- // #endif
|