Foo-composition.uvue 801 字节
Newer Older
1 2 3 4
<template>
  <view>
    <slot name="header" :msg="msg"></slot>
    <slot :num="num"></slot>
5 6 7 8
    <slot name="num1" :num="num"></slot>
    <slot name="num2" :num="num"></slot>
    <slot name="msgTrue" :msg="msg"></slot>
    <slot name="msgFalse" :msg="msg"></slot>
9 10 11 12 13 14 15 16 17 18 19 20
    <slot name="footer" :arr="arr"></slot>
  </view>
</template>

<script setup lang='uts'>
  const msg = ref('foo msg')
  const num = ref<number>(0)
  const arr = ref<string[]>(['a', 'b', 'c'])

  defineSlots<{
    header(props : { msg : string }) : any,
    default(props : { num : number }) : any,
21 22 23 24
    num1(props : { num : number }) : any,
    num2(props : { num : number }) : any,
    msgTrue(props : { msg : string }) : any,
    msgFalse(props : { msg : string }) : any,
25 26 27
    footer(props : { arr : string[] }) : any
  }>()
</script>