pinia 支持热模块替换,因此你可以编辑store,并直接在您的应用程序中与它们交互(在浏览器中进行调试html css js等代码),而无需重新加载页面,允许您保持现有的状态,添加,甚至删除state,action和getter

import { defineStore, acceptHMRUpdate } from "pinia"
import axios from "axios"
export const useCountStore = defineStore("count", {
state: () => {
return {
count: 10
}
},
getters: {
getCount: (state) => "当前Count:" + state.count
}
})
if (import.meta.hot) {
import.meta.hot.accept(acceptHMRUpdate(useCountStore, import.meta.hot))
}
