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.
文档说这是可能的,但没有示例说明如何。一个人会怎么做?
该setup()方法就像是常规组件的附加组件,因此我们可以将其与数据、方法等一起包含在内。
setup()
function useSomething() { // ... } const Component = { setup() { const { out1, out2 } = useSomething(); return { out1, out2 }; }, data: function () { // ... }, methods: { // ... }, }