2 files added
4 files modified
| | |
| | | :info-text="activeUser.description" |
| | | :role="activeUser.role" |
| | | ></user-info> |
| | | <course-goals> |
| | | <template #default="slotProps"> |
| | | <h2>{{ slotProps.item }}</h2> |
| | | <p>{{ slotProps['anotherProp'] }}</p> |
| | | <p>{{ slotProps.ciccio }}</p> |
| | | </template> |
| | | </course-goals> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | 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: TheHeader, |
| | | TheHeader, |
| | | BadgeList, |
| | | UserInfo |
| | | UserInfo, |
| | | CourseGoals, |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | <template> |
| | | <section> |
| | | <h2>Available Badges</h2> |
| | | <ul> |
| | | <li> |
| | | <base-badge type="admin" caption="ADMIN"></base-badge> |
| | | </li> |
| | | <li> |
| | | <base-badge type="author" caption="AUTHOR"></base-badge> |
| | | </li> |
| | | </ul> |
| | | <base-card> |
| | | <template #header> |
| | | <h2>Available Badges</h2> |
| | | </template> |
| | | <template #default> |
| | | <ul> |
| | | <li> |
| | | <base-badge type="admin" caption="ADMIN"></base-badge> |
| | | </li> |
| | | <li> |
| | | <base-badge type="author" caption="AUTHOR"></base-badge> |
| | | </li> |
| | | </ul> |
| | | </template> |
| | | </base-card> |
| | | </section> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | section { |
| | | margin: 2rem auto; |
| | | max-width: 30rem; |
| | | border-radius: 12px; |
| | | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26); |
| | | padding: 1rem; |
| | | } |
| | | |
| | | section h2 { |
| | | margin: 0.5rem 0; |
| | | color: #3a3a3a; |
| | | } |
| | | |
| | | ul { |
| | | list-style: none; |
| | | margin: 0; |
New file |
| | |
| | | <template> |
| | | <div> |
| | | <header v-if="$slots.header"> |
| | | <slot name="header"> |
| | | <!-- <h2>Default Title </h2> --> |
| | | </slot> |
| | | </header> |
| | | <slot></slot> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | mounted() { |
| | | console.log(this.$slots); |
| | | } |
| | | |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | div { |
| | | margin: 2rem auto; |
| | | max-width: 30rem; |
| | | border-radius: 12px; |
| | | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26); |
| | | padding: 1rem; |
| | | } |
| | | |
| | | section header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <ul> |
| | | <li v-for="goal in goals" :key="goal"> |
| | | <slot :item="goal" another-prop="qualcosa" ciccio="ciccio"></slot> |
| | | </li> |
| | | </ul> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | goals: ['Finish the course', 'Learn Vue'], |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <template> |
| | | <section> |
| | | <header> |
| | | <h3>{{ fullName }}</h3> |
| | | <base-badge :type="role" :caption="role.toUpperCase()"></base-badge> |
| | | </header> |
| | | <p>{{ infoText }}</p> |
| | | <base-card> |
| | | <template #header> |
| | | <h3>{{ fullName }}</h3> |
| | | <base-badge :type="role" :caption="role.toUpperCase()"></base-badge> |
| | | </template> |
| | | <template #default> |
| | | <p>{{ infoText }}</p> |
| | | </template> |
| | | </base-card> |
| | | </section> |
| | | </template> |
| | | |
| | |
| | | props: ['fullName', 'infoText', 'role'], |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | section { |
| | | margin: 2rem auto; |
| | | max-width: 30rem; |
| | | border-radius: 12px; |
| | | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26); |
| | | padding: 1rem; |
| | | } |
| | | |
| | | section header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | </style> |
| | |
| | | |
| | | import App from './App.vue'; |
| | | import BaseBadge from './components/BaseBadge.vue'; |
| | | import BaseCard from './components/BaseCard.vue'; |
| | | |
| | | |
| | | const app = createApp(App); |
| | | |
| | | app.component('base-badge', BaseBadge); |
| | | app.component('base-card', BaseCard); |
| | | |
| | | app.mount('#app'); |