0

文档说这是可能的,但没有示例说明如何。一个人会怎么做?

4

1 回答 1

0

setup()方法就像是常规组件的附加组件,因此我们可以将其与数据、方法等一起包含在内。

function useSomething() {
  // ...
}

const Component = {
  setup() {
    const { out1, out2 } = useSomething();
    return { out1, out2 };
  },
  data: function () {
    // ...
  },
  methods: {
    // ...
  },
}
于 2020-07-29T09:54:46.037 回答