1
我一直在試圖讓路由器視圖在模態(如twitter)中工作。任何人都可以幫忙?如何在模態中打開vue-router
這也許才達到的是一種方式,但如果是正確的方式
const Foo = { template: '<div>foo</div>' }
const Bar = { template: '<div>bar</div>' }
const router = new VueRouter({
mode: 'history',
routes: [
{
path: '/other',
components: {
default: Foo,
modal: Bar,
}
}
]
})
new Vue({
\t router,
el: '#app'
})
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
<div id="app">
<h1>Named Views</h1>
<ul>
<li>
<router-link to="/">/</router-link>
</li>
<li>
<router-link to="/other">/other</router-link>
</li>
</ul>
<router-view class="view one"></router-view>
<router-view class="view two" name="modal"></router-view>
</div>
如何使用模內打開模態路由器觀點我不知道?