init commit

This commit is contained in:
叶志超
2022-04-07 22:17:28 +08:00
commit d24c9643ce
30 changed files with 887 additions and 0 deletions

28
src/stores/Point.js Normal file
View File

@@ -0,0 +1,28 @@
import { defineStore } from 'pinia'
export const usePointStore = defineStore({
id: 'point',
state: () => ({
index: 0,
length: 10,
rawItems: [],
}),
getters: {
items: (state) => {
const items = state.rawItems
items.length = state.length
return items
}
},
actions: {
addItem(item) {
if (this.index >= this.length) {
return
}
this.rawItems[this.index] = item
this.index++
},
},
})