我有一个<header-row>
组件,我放在所有页面的顶部以显示标题和副标题。这就是我想要做的事情:
item.display
)从列表中传递到下一页prop
<header-row>
组件中的道具来显示该页面的标题。 似乎很简单,但我无法完成最后两个步骤:
<template>
<div>
<h3 class='text-primary'>{{ title }}</h3>
<h5 class='text-muted'>{{ subTitle }}</h5>
</div>
</template>
<script>
export default {
props: [
'title',
'subTitle'
]
}
</script>
<router-link v-for="item in items" :to="{ name: 'some-page' } myProp="item.name">
{{ item.display }}
</router-link>
<template>
<div>
<header-row title="myProp"></header-row>
<div class='container-fluid'>
<div class='row'>
<div class='col-4'>
... stuff here....
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'child-stuff',
props: [
'myProp'
]
}
</script>
import Vue from 'vue'
import Router from 'vue-router'
import Dashboard from '@/views/Dashboard'
... more here ....
import AROverview from '@/views/ar/Overview'
import Invoice from '@/views/ar/Invoice'
import APOverview from '@/views/ap/Overview'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'dashboard',
component: Dashboard
},
{
path: '/receivables/:id',
name: 'ar',
component: AROverview
},
{
path: '/invoice/:id',
name: 'invoice',
component: Invoice
},
... more ...
{
path: '/payables/:id',
name: 'ap',
component: APOverview
}
]
})