lesson 113: add a scoped slot

This commit is contained in:
Andreas Zweili 2021-02-07 11:17:20 +01:00
parent f9f5d32d51
commit 6e3c4e4a25
2 changed files with 26 additions and 0 deletions

View File

@ -7,6 +7,11 @@
:info-text="activeUser.description"
:role="activeUser.role"
></user-info>
<course-goals>
<template #default="slotProps">
<h2>{{ slotProps.item }}</h2>
</template>
</course-goals>
</div>
</template>
@ -14,12 +19,14 @@
import TheHeader from "./components/TheHeader.vue";
import BadgeList from "./components/BadgeList.vue";
import UserInfo from "./components/UserInfo.vue";
import CourseGoals from "./components/CourseGoals.vue";
export default {
components: {
TheHeader,
BadgeList,
UserInfo,
CourseGoals,
},
data() {
return {

View File

@ -0,0 +1,19 @@
<template>
<div>
<ul v-for="goal in goals" :key="goal">
<slot :item="goal"></slot>
</ul>
</div>
</template>
<script>
export default {
data() {
return {
goals: ["Finish the course", "Learn Vue"],
};
},
};
</script>
<style></style>