vue-router应用于组件内时的矛盾怎么解决?
遵循以下几个步骤即可解决应用于组件内的矛盾:
入口点 main.js
输入import App from './components/App.vue'
router.start(App, '#app')
然后在App.vue 也就是根组件里面声明router-view
<router-view
class="view"
keep-alive
transition
transition-mode="out-in">
</router-view>
补充,基于vueJS2.0的代码:
vuejs/vue-hackernews-2.0: HackerNews clone built with Vue 2.0, vue-router & vuex, with server-side rendering
先是入口点 main.js
import App from './components/App.vue'
router.start(App, '#app')
然后在App.vue 也就是根组件里面声明router-view
<router-view class="view" keep-alive transition transition-mode="out-in"> </router-view>