How to use spread operator in <script setup> Vue3

Viewed 134
<script setup lang="ts">
  const {a,b,c,d,e,f,g,...h} = useTest(); // useTest() return a lot of fields;
</script>

I don't want to list all the fields;

How to use spread operator like this: ...useTest();

Is the only way to add a <script> tag?

<script lang="ts">
  import { useTest } from '.'
  export default {
    setup(){
      return {
        ...useTest(),
      }
    }
  }
</script>
0 Answers
Related