vue针对循环中slot的传参数

vue针对循环中使用slot传参数问题

1,v-slot

<List :dataList="list" v-slot:fatherSlot="{item}">
    <ListItem slot="fatherSlot">
         <div slot="child">{
   
   {item.title}}</div>
     </ListItem>
 </List>

2,slot-scope

<List :dataList="list" >
   <ListItem slot="fatherSlot" slot-scope="slotProps">
        <div slot="child">{
   
   {slotProps.item.title}}</div>
    </ListItem>
</List>

3,slot-scope+v-slot

<List :dataList="list" v-slot:fatherSlot="slotProps">
     <ListItem slot="fatherSlot">
          <div slot="child">{
   
   {slotProps.item.title}}</div>
      </ListItem>
  </List>

猜你喜欢

转载自blog.csdn.net/shidouyu/article/details/125368588