From eb387dbd90a2a891ee5ee4458e32cccb460fd9b1 Mon Sep 17 00:00:00 2001 From: Cristiano Magro <cristiano.magro@vola.it> Date: Mon, 06 Jan 2025 18:15:48 +0100 Subject: [PATCH] first components e props --- 09 - deeper into components/cmp-adv-07-keeping-dynamic-components-alive/src/App.vue | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+), 0 deletions(-) diff --git a/09 - deeper into components/cmp-adv-07-keeping-dynamic-components-alive/src/App.vue b/09 - deeper into components/cmp-adv-07-keeping-dynamic-components-alive/src/App.vue new file mode 100644 index 0000000..d271300 --- /dev/null +++ b/09 - deeper into components/cmp-adv-07-keeping-dynamic-components-alive/src/App.vue @@ -0,0 +1,55 @@ +<template> + <div> + <the-header></the-header> + <!-- <TheHeader /> --> + <button @click="setSelectedComponent('active-goals')">Active Goals</button> + <button @click="setSelectedComponent('manage-goals')">Manage Goals</button> + <!-- <active-goals v-if="selectedComponent === 'active-goals'"></active-goals> + <manage-goals v-if="selectedComponent === 'manage-goals'"></manage-goals>--> + <keep-alive> + <component :is="selectedComponent"></component> + </keep-alive> + </div> +</template> + +<script> +import TheHeader from './components/TheHeader.vue'; +// import BadgeList from './components/BadgeList.vue'; +// import UserInfo from './components/UserInfo.vue'; +// import CourseGoals from './components/CourseGoals.vue'; +import ActiveGoals from './components/ActiveGoals.vue'; +import ManageGoals from './components/ManageGoals.vue'; + +export default { + components: { + TheHeader, + ActiveGoals, + ManageGoals, + }, + data() { + return { + selectedComponent: 'active-goals', + activeUser: { + name: 'Maximilian Schwarzmüller', + description: 'Site owner and admin', + role: 'admin', + }, + }; + }, + methods: { + setSelectedComponent(cmp) { + this.selectedComponent = cmp; + }, + }, +}; +</script> + +<style> +html { + font-family: sans-serif; +} + +body { + margin: 0; +} +</style> \ No newline at end of file -- Gitblit v1.8.0