mount Vue apps into container of main Vue app

后端 未结 2 1186
走了就别回头了
走了就别回头了 2021-01-12 04:09

I would like to create a base Vue app providing basic functionality like signing in, navigating through a sidebar etc. But the navbar items have to be interchangeable. I wan

2条回答
  •  Happy的楠姐
    2021-01-12 04:35

    1

    Vue does not know CustomAppContainer

    Try to add import CustomAppContainer from "path/to/CustomAppContainer.vue"
    It must be in .vue file.


    2

    Vue does not know #customAppContainer

    Yes, that selector must be in index.html. Yours is in CustomAppContainer. Try to add to index.html (usually in /public folder) something like

    and replace .$mount('#customAppContainer'); with .$mount('#app');


    3

    Vue router needs tag. So, try this markup:

    
    
    

    4

    Router.js needs import:

    import Home from "path/to/the/Home.vue"
    export default new Router({
      base: '/one/',
      routes: [
        {
          path: '/',
          component: Home,
        },
      ],
    });
    

    All is good?

提交回复
热议问题