Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嘿想知道原因:)
为什么要导入useStore函数而不是直接导入/store/index.js文件 https://next.vuex.vuejs.org/guide/composition-api.html
好像是一样的
useStore使用inject(provide/inject api) 访问商店。这意味着不需要从另一个文件/依赖项传递存储。之所以首选它,只是因为它在主题上与组合 API(钩子)一致。
useStore
inject