既然获取分发的内容,应该在子组件里面写这个实例属性。

父组件

  <ui-timeline v-if="total > 0">
    <ui-timeline-item
      :timelineItemPaddingBottom="50"
      v-for="(item,index) in tableData"
      :key="index"
      :icon="item.icon"
      :fontWeight="item.fontWeight"
      :circle="item.circle"
      :timestamp="item.timestamp">
      <span slot="dot">{{index + 1}}</span>
      {{item.content}}
    </ui-timeline-item>
  </ui-timeline>

子组件

<template>
    <div v-if="$slots.dot">
      <slot name="dot"></slot>
    </div>
</template>

子组件 打印信息

Logo

前往低代码交流专区

更多推荐