You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
具体表现为我在代码中使用了Symbol("test")作为store的key值,在热重载后使用useStore(Symbol("test"))获取store的实例失败,原因是热重载后的Symbol与之前的Symbol不一致。
`
// vuex store.ts
export const store = createStore({});
export const key: InjectionKey<Store> = Symbol("test");
// main.ts
import { key } from './store'
window.key = key; // 测试使用
const app = createApp(App).use(store, key).mount("#app");
//App.vue
import { key } from './store'
console.log(key === window.key) //page reload打印值为true, hot update后打印值为false
`
Beta Was this translation helpful? Give feedback.
All reactions