1. // 动态切换
    2. <component :is="is"></component>
    3. <script>
    4. // 引入
    5. import qwe from 'components/qwe/qwe.vue'
    6. import zxc from 'components/zxc/zxc.vue'
    7. // 省略其他...
    8. // 注册
    9. components:{
    10. qwe,
    11. zxc
    12. },
    13. data(){
    14. return {
    15. is:'' // 要显示的组件名字 通过控制这个变量达到动态切换的目的
    16. }
    17. }
    18. </script>