lesson 130: add tabs
This commit is contained in:
parent
480b9ee49b
commit
63f0e3d148
|
@ -1,33 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<the-header title="One big application"></the-header>
|
<the-header title="One big application"></the-header>
|
||||||
<stored-resources :stored-resources="storedResources"></stored-resources>
|
<the-resources></the-resources>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TheHeader from './components/layouts/TheHeader';
|
import TheHeader from './components/layouts/TheHeader';
|
||||||
import storedResources from './components/resources/StoredResources';
|
import TheResources from './components/resources/TheResources.vue';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
storedResources,
|
TheHeader,
|
||||||
TheHeader
|
TheResources
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
storedResources: [
|
|
||||||
{
|
|
||||||
id: 'official-guide',
|
|
||||||
title: 'Oficial Guide',
|
|
||||||
description: 'The official documentation for Vue.js.',
|
|
||||||
link: 'https://vuejs.org'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'duckduckgo',
|
|
||||||
title: 'Duckduckgo',
|
|
||||||
description: 'A search engine that values privacy.',
|
|
||||||
link: 'https://duckduckgo.com'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<template>
|
||||||
|
<h2>Add Resource</h2>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
|
@ -15,7 +15,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
LearningResource
|
LearningResource
|
||||||
},
|
},
|
||||||
props: ['stored-resources']
|
inject: ['storedResources']
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<template>
|
||||||
|
<base-card>
|
||||||
|
<base-button @click="setSelectedTab('stored-resources')"
|
||||||
|
>Stored Resources</base-button
|
||||||
|
>
|
||||||
|
<base-button @click="setSelectedTab('add-resources')"
|
||||||
|
>Add Resource</base-button
|
||||||
|
>
|
||||||
|
</base-card>
|
||||||
|
<component :is="selectedTab"></component>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import StoredResources from './StoredResources';
|
||||||
|
import AddResource from './AddResource';
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
StoredResources,
|
||||||
|
AddResource
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
selectedTab: 'stored-resources',
|
||||||
|
storedResources: [
|
||||||
|
{
|
||||||
|
id: 'official-guide',
|
||||||
|
title: 'Oficial Guide',
|
||||||
|
description: 'The official documentation for Vue.js.',
|
||||||
|
link: 'https://vuejs.org'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'duckduckgo',
|
||||||
|
title: 'Duckduckgo',
|
||||||
|
description: 'A search engine that values privacy.',
|
||||||
|
link: 'https://duckduckgo.com'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setSelectedTab(tab) {
|
||||||
|
this.selectedTab = tab;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
provide() {
|
||||||
|
return {
|
||||||
|
storedResources: this.storedResources
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
Reference in New Issue