I have introduced header and tail components into App.vue so that all pages of the project have headers and tails, but I only need some pages to introduce
so far.I have introduced header and tail components into App.vue so that all pages of the project have headers and tails, but I only need some pages to introduce
so far. this is a simple and better way to implement using router-view sub-routing. Methods such as using v-if control and inserting the head and footer of the page into each page you need can also be achieved, but it is not very good and is not recommended. The following details are as follows:
put all the pages that you need at the end of the header into a routed child route. For example, if there are two components of AB that represent a page, and page A shows the header and footer of the page and inserts the child route at the same time (components are a.vue and b.vue), the A.vue can be written as follows:
<template>
<div>
<header/>
<router-view></router-view>
<footer/>
</div>
</template>
routing can be configured as:
[
{
path: '/pageA',
component: () => import('@/components/A.vue'),
children: [
{
path: '/',
redirect: '/pageA/a'
},
{
path: '/a',
component: () => import('@/components/a.vue')
},
{
path: '/b',
component: () => import('@/components/b.vue')
}
]
},
{
path: '/pageB',
component: () => import('@/components/B.vue')
}
]
so that all child routing pages under page A will have a head and tail, and only one head and tail will be created.
landlord, just judge the load according to your route
.
simple idea, define an array, here is the route that needs to introduce header and tail components path
. Then in the App.vue
file, make a match when listens for route changes .
learn about the following child routes
use the vuex control component to post a link https://blog.csdn.net/zgh0711.
Next: Angular iframe
requirements: implement the reuse of Vue.js but single-page applications that is to put a single page as a page (module or component) into another Vue.js project through vue-router routing. question: I don t know what the professional name of this...
in the Vue component, the value in the object returned by Data is modified by the method in Methods, but the whole page is not re-rendered according to the modified value export default { data () { let page = this.$attrs[ page ] let pageSize = this....
example: there are resource lists, builds, army lists, and other components in the game, all of which require resource variables. build reduces the number of resource values. How does this change spread to other components? the current solutio...
the problem is difficult to describe. Let me give an example. For example, the following code is in the header of the page: <template> <div class="header"> ... < div> < template> <script> export default {...
I have used window.onresize in the hook functions of both components and found that the later components will overwrite the window.onresize of the previous components. Is there any way to ensure that the window.onresize of all components can not affect e...