Dynamic component, add resource, styling tabs
ristutturazione del codice per inserire la tabs bar e gestirla con dei button custom
2 files added
2 files modified
| | |
| | | <template> |
| | | <TheHeader :title="rememberMe"></TheHeader> |
| | | <stored-resources :resources="storedResouces"> </stored-resources> |
| | | <TheResources></TheResources> |
| | | </template> |
| | | |
| | | <script> |
| | | import StoredResources from './components/learning-resource/StoredResource.vue'; |
| | | import TheHeader from './components/layouts/TheHeader.vue'; |
| | | import TheResources from './components/learning-resource/TheResources.vue'; |
| | | |
| | | export default { |
| | | components: { |
| | | StoredResources: StoredResources, |
| | | TheHeader: TheHeader, |
| | | TheResources: TheResources, |
| | | }, |
| | | data() { |
| | | return { |
| | | rememberMe: 'Remember Me', |
| | | storedResouces: [ |
| | | { |
| | | id: 'official-guide', |
| | | title: 'Official Guide', |
| | | description: 'The official Vue.js documentation', |
| | | link: 'https://vuejs.org', |
| | | }, |
| | | { |
| | | id: 'google', |
| | | title: 'Google', |
| | | description: 'Learn to google...', |
| | | link: 'https://google.com', |
| | | }, |
| | | ], |
| | | }; |
| | | }, |
| | | }; |
New file |
| | |
| | | <template> |
| | | <h2>Add Resource</h2> |
| | | </template> |
| | | |
| | | <script>export default{}</script> |
| | | |
| | | <style scoped></style> |
| | |
| | | components: { |
| | | LearningResource: LearningResource, |
| | | }, |
| | | |
| | | props: ['resources'], |
| | | inject: ['resources'], |
| | | }; |
| | | </script> |
| | | |
New file |
| | |
| | | <template> |
| | | <base-card> |
| | | <base-button |
| | | @click="setSelectedTab('stored-resources')" |
| | | :mode="storedResButtonMode" |
| | | >Stored Resource</base-button |
| | | > |
| | | <base-button |
| | | @click="setSelectedTab('add-resource')" |
| | | :mode="addResButtonMode" |
| | | >Add Resource</base-button |
| | | > |
| | | </base-card> |
| | | <component :is="selectedTab"></component> |
| | | </template> |
| | | |
| | | <script> |
| | | import StoredResources from './StoredResource.vue'; |
| | | import AddResource from './AddResource.vue'; |
| | | |
| | | export default { |
| | | components: { |
| | | StoredResources: StoredResources, |
| | | AddResource: AddResource, |
| | | }, |
| | | data() { |
| | | return { |
| | | selectedTab: 'stored-resources', |
| | | storedResouces: [ |
| | | { |
| | | id: 'official-guide', |
| | | title: 'Official Guide', |
| | | description: 'The official Vue.js documentation', |
| | | link: 'https://vuejs.org', |
| | | }, |
| | | { |
| | | id: 'google', |
| | | title: 'Google', |
| | | description: 'Learn to google...', |
| | | link: 'https://google.com', |
| | | }, |
| | | ], |
| | | }; |
| | | }, |
| | | computed: { |
| | | storedResButtonMode() { |
| | | return this.selectedTab === 'stored-resources' ? null : 'flat'; |
| | | }, |
| | | addResButtonMode() { |
| | | return this.selectedTab === 'add-resource' ? null : 'flat'; |
| | | }, |
| | | }, |
| | | provide() { |
| | | return { |
| | | resources: this.storedResouces, |
| | | }; |
| | | }, |
| | | methods: { |
| | | setSelectedTab(tab) { |
| | | this.selectedTab = tab; |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped></style> |