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.
在 Vue 3(组合 API)Pania 存储上初始化状态时,哪种模式更“正确”或更惯用?
选项1:
state: () => ({ user: {}, }),
选项 2:
state: () => { return { user: {}, }; },
选项3:也许还有别的?
选项2。它应该是一个返回状态的函数。https://pinia.vuejs.org/core-concepts/state.html