子组件内容:
<template>
<div class="card">
<div class="card-title">
<slot name="title">{{title}}</slot>
</div>
<a-list>
<a-list-item v-for="(item,index) in items" :key="index">
<slot name="content" :item="item">{{item}}</slot>
</a-list-item>
</a-list>
</div>
</template>
父组件内容:
<list-card class="right-card " :items="hotSearchs">
<template slot="title">
<span class="title-head">热词TOP5</span>
</template>
<template #content="{item}">
<a-tag class="word"># {{ item.word }}</a-tag>
<span class="count">
<fire theme="outline" size="24" fill="#333" />
</span>
</template>
</list-card>
父组件引入子组件方式:#comtent = {item}
或者:v-slot:content = "scoped"