diff --git a/main.js b/main.js
index da46995..5f2b9af 100644
--- a/main.js
+++ b/main.js
@@ -1,13 +1,16 @@
-import { createSSRApp } from 'vue'
-import store from './store'
-import App from './App.vue'
-import $lu from './lu'
-
-uni.$lu = $lu
-export function createApp() {
- const app = createSSRApp(App)
- app.use(store)
- return {
- app
- }
-}
+import {
+ createSSRApp
+} from 'vue'
+import * as Pinia from 'pinia';
+import App from './App.vue'
+import $lu from './lu'
+
+uni.$lu = $lu
+export function createApp() {
+ const app = createSSRApp(App)
+ app.use(Pinia.createPinia())
+ return {
+ app,
+ Pinia
+ }
+}
diff --git a/pages/dev/dev/Navbar/Navbar.vue b/pages/dev/dev/Navbar/Navbar.vue
index 61eac85..7fa811e 100644
--- a/pages/dev/dev/Navbar/Navbar.vue
+++ b/pages/dev/dev/Navbar/Navbar.vue
@@ -1,10 +1,15 @@
-
+
diff --git a/pages/dev/dev/Pinia/Pinia.vue b/pages/dev/dev/Pinia/Pinia.vue
new file mode 100644
index 0000000..df5acca
--- /dev/null
+++ b/pages/dev/dev/Pinia/Pinia.vue
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+ {{ $store.count }}
+
+
+
+
+
+
diff --git a/pages/dev/dev/Vuex/Vuex.vue b/pages/dev/dev/Vuex/Vuex.vue
deleted file mode 100644
index 606f0fe..0000000
--- a/pages/dev/dev/Vuex/Vuex.vue
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
- {{ $store.state.count }}
-
-
-
-
-
-
diff --git a/pages/dev/dev/dev.vue b/pages/dev/dev/dev.vue
index 4cdd953..8b3e5c1 100644
--- a/pages/dev/dev/dev.vue
+++ b/pages/dev/dev/dev.vue
@@ -7,7 +7,7 @@
import NavbarComponent from './Navbar/Navbar.vue' // Navbar
import RouterQueryComponent from './RouterQuery/RouterQuery.vue' // 路由参数
import ApiComponent from './Api/Api.vue' // 接口
- import VuexComponent from './Vuex/Vuex.vue' // Vuex
+ import PiniaComponent from './Pinia/Pinia.vue' // Pinia
import RouterPushComponent from './RouterPush/RouterPush.vue' // 路由跳转
import FatherComponent from './SonFather/Father.vue' // 子父组件
import UserAvatarComponent from './UserAvatar/UserAvatar.vue' // 用户头像
@@ -31,7 +31,7 @@
-
+
diff --git a/store/index.js b/store/index.js
index dc2990d..74f6f90 100644
--- a/store/index.js
+++ b/store/index.js
@@ -1,22 +1,19 @@
import {
- createStore
-} from "vuex";
+ defineStore
+} from 'pinia';
-export default createStore({
- state: {
- count: 1,
- loading: 0,
- },
- mutations: {
- loadingStart(state) {
- state.loading++
+export const useStore = defineStore('counter', {
+ state: () => ({
+ count: 1,
+ loading: 0,
+ }),
+ actions: {
+ loadingStart() {
+ this.loading++
},
- loadingDone(state) {
- state.loading--
- if (state.loading < 0) state.loading = 0
+ loadingDone() {
+ this.loading--
+ if (this.loading < 0) this.loading = 0
}
},
- actions: {},
- getters: {},
- modules: {}
-});
+});