组件A:
<template>
<div>
<template v-for="(row, index) in rows">
<slot :row="row" :index="index" />
</template>
</div>
</template>
<script>
export default {
data() {
return {
rows: ["a", "b", "c"]
};
}
};
</script>
组件B:
<template>
<div>
{{ row }}
{{ index }}
</div>
</template>
<script>
export default {
props: ["row", "index"]
};
</script>
组件C:
<A>
<template v-slot:default="{ row, index }">
<B :row="row" :index="index"></B>
</template>
</A>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…