feat: 新增路由|状态管理依赖
This commit is contained in:
23
src/store/index.js
Normal file
23
src/store/index.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { createPinia } from 'pinia'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
// 创建pinia实例
|
||||
const pinia = createPinia()
|
||||
|
||||
// 定义一个基本的store
|
||||
export const useMainStore = defineStore('main', {
|
||||
state: () => ({
|
||||
count: 0
|
||||
}),
|
||||
|
||||
actions: {
|
||||
increment() {
|
||||
this.count++
|
||||
},
|
||||
decrement() {
|
||||
this.count--
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export default pinia
|
||||
Reference in New Issue
Block a user