vuejs件同一个挂载点上切换组

vuejs件同一个挂载点上切换组

动态组件
http://cn.vuejs.org/guide/components.html#动态组件

多个组件可以使用同一个挂载点,然后动态地在它们之间切换。使用保留的 元素,动态地绑定到它的 is 特性:

new Vue({
  el: 'body',
  data: {
    currentView: 'home'
  },
  components: {
    home: { /* ... */ },
    posts: { /* ... */ },
    archive: { /* ... */ }
  }
})
<component :is="currentView">
  <!-- 组件在 vm.currentview 变化时改变 -->
</component>
posted @ 2016-06-28 07:38  CooMark  阅读(1071)  评论(0)    收藏  举报