我路由了两个页面:
Home > Results
在“主页”内部,我有一个不在<route-view/>
中的按钮/链接,我希望该按钮通过参数重定向到Results.vue
。
这个名为activeTab
的参数必须打开所需的vue-tabs
,我无法完成,因为它没有从变量中获取任何东西:
代码:
Home.vue
<div class="row"> <Notes refName="Relationship" /> <Notes refName="Support" /> </div> ... <script> import Notes from '@/components/Monthlynotes.vue' export default { name: 'home', components: { Notes }, </script>
/components/Monthlynotes.vue
<b-card> <p class="card-text">{{ refName }}</p> <b-link class="right" :activeTab="refName" href="/results">More</b-link> </b-card> ... <script> export default { props: { refName: String, }, </script>
Results.vue
<vue-tabs type="pills" v-model="tabName"> <v-tab title="Relationship"> <RelDT msg="Results view"/> </v-tab> <v-tab title="Support"> <SupDT msg="Results view"/> </v-tab> </vue-tabs> ... <script> import RelDT from '@/components/DataTable.rel.vue' import SupDT from '@/components/DataTable.sup.vue' export default { name: 'results', props: { activeTab: String }, components: { RelDT, SupDT, }, data() { return { tabName: activeTab } } } </script>
App
<router-link :to="{name:'results', param:{activeTab}}">Results</router-link>
如果这条<b-link>
是<route-link />
,我怎么做?
答案 0 :(得分:0)
即使b-link
组件也支持:to
属性。被发现here
该属性的值将传递到router.push()
。
<b-link :to="{name:'results', param:{activeTab}}">Redirect me</b-link>