First image is from parent Page, wenn i click on an item from navigation then child Page opens but i do not need same header as Parent's header, i need header with back arrow like in second image for child but without parent's header.
I have also added Sandbox link, please check App.vue, Help.vue, Help-info.vue , main.js, registerServiceWorker.js, index.js, vue.config.js ...
Others files are auto generated by this Sandbox editor.
Link For live Testing
Related
We have HEADER and FOOTER components inside _app.tsx and we are using SSR and SSG.
But we want to prerender html for HEADER and FOOTER components also like the pages (for effective SEO).
As we cant do use getServerSideProps and getStaticProps inside _app.tsx, we are using HEADER and FOOTER components in each and every page and calling the APIs for HEADER and FOOTER in getServerSideProps inside every page.
But which is leading to render HEADER and FOOTER components in every page.
So is there any way to make HEADER and FOOTER components in one file and still get prerendering for them too?
You can create a layout component and add it inside your "_app.ts" file, so the layout is shared throughout your application.
You can find more information about this on Next Js documentation
https://nextjs.org/docs/basic-features/layouts
For example:
I have an url like /content/supercontenturl/.
If this content type is a video (param in my DB), I'll show videoplayer on the page and other components, but if type of content is text or other, I'd like to load specific page.vue for this content with own components, but the url must be same - /content/supercontenturl/
My structure pages:
index.vue
/content/
/_supercontenturl/
_id.vue // The page for video
_id_text.vue // The page for text
... // Other pages
index.vue
you should remember in nuxt all vue files inside Pages directory are components check the guide, and each file or directory you add there will create routes.
the easy way to succeed your demand is put the video page and content page with a proper name in components directory. Create a new file in pages it will contains in scripts the data call and template will contains the component selector, you can use a v-if or dinamic components for load the right component. and pass the data by props.
https://moeddami.github.io/nuxt-material-admin-demo/dashboard/
In the above link i want the sidebar component towards right when $vuetify.rtl is enabled.
I'm building a single-file-based Vue application from a template generated with the Vue UI tool.
I understand how a .vue file defines the styling/structure/behavior of a component, how smaller components can be composed into bigger components, and how the top-level "App" component mounts everything to an HTML Div.
As the user progresses through the app, though -- say from a login screen to a master screen to a detail screen -- what's the accepted approach to switching out the current screen-level component?
Ty in advance.
--The Vuebie
This is quite an open ended question so ill just show you what I have done in my own projects. I split my components directory into two directories; 'pages' and 'common'. (Ignore the 'firebase' directory is it beyond the scope of this question).
The common directory holds components that may be used in a page or re used in several different pages.
For example the 'account form' is used in my 'Edit Account page' and the category bar is used in several of my pages.
The pages directory holds components that are technically no different from my common components but they represent full pages on my website. A page component may contain several common components.
Now the biggest distinction between common and pages is in the router. I route different paths relative to the main url (that is probably not the technically correct description but hopefully you get the point) to each of the pages. Here is my index.js file from my router directory:
As you can see, I have a route pointing to each one of my pages. You can " switch out the current screen-level component" (as you put it) by using router-link tag's to navigate between different page components. These are clickable urls that your client can use, they can also be wrapped in buttons and such.
For example, this router link navigates to my home page, the component name is 'Helloworld'. See its corresponding reference in my router's index.js and in the pages directory so you can connect it all in your head.
<router-link class="nav-item nav-word" :to="{ name: 'HelloWorld' }">
Finally, I will talk a bit about the App.vue file. The App.vue acts like a base component as it contains the 'router view' tag within it's template:
<router-view/>
This means that every page that you route will be placed in the position of the 'router view tag'. I.e this tag will be replaced with the page. It is common practise to surround this tag with html code that you would like to be shown in each page. For example I have my router view tag between my nav bar and footer. So that the nav bar and footer will show on each page.
In bootstrap hash links are used to toggle collapsible panels:
<Link to='#' data-toggle='collapse' data-target={dataTarget} aria-expanded='false'>{this.props.text}</Link>
When clicking a link like this I would like react router to not re-render the components.
The above link is used in an nav-menu that overflows some page content. When the link is clicked in the menu it causes the page content to refresh. This happens because react router picks up the click on the link and as a result the route for the current page is triggered.
How can I avoid this so the link just toggles the collapsible panel without causing a re-render?
remove # from to='#'` and it won't refresh.