Skip to content

Commit

Permalink
feat(LMainFooter): modify data fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwa committed Mar 7, 2020
1 parent 6e62aaa commit 9eda08f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
13 changes: 4 additions & 9 deletions src/layouts/LMainFooter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@ export default Vue.extend({

functional: true,

props: {
sticky: {
type: Boolean,
default: true
}
},

render(h: CreateElement, { props }): VNode | VNode[] {
render(h: CreateElement, { parent }): VNode | VNode[] {
const vNodes = [h('router-view')]

function createAnchorElement(
Expand All @@ -38,7 +31,9 @@ export default Vue.extend({
)
}

if (props.sticky) {
const layoutPayload: Record<'sticky', boolean> = (parent.$route.meta || {})
.layoutPayload
if (layoutPayload && layoutPayload.sticky) {
vNodes.push(
h(
'footer',
Expand Down
8 changes: 5 additions & 3 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ export const routes = [
{
path: '/',
name: 'Home',
component: () => import(/* webpackChunkName: "home" */ '../views/Home.vue'),
meta: {}
component: () => import(/* webpackChunkName: "home" */ '../views/Home.vue')
},
{
path: '/#',
name: 'Login',
component: () =>
import(/* webpackChunkName: 'login' */ '../views/#/index.vue'),
meta: {
layout: 'LMainFooter'
layout: 'LMainFooter',
layoutPayload: {
sticky: true
}
}
},
{
Expand Down

0 comments on commit 9eda08f

Please # to comment.