Vue.js on-demand loading module issu

there is a book-list component, on Home that simply lists the covers and names of some books. Each book can click on the cover to go to the BookDetail page, and these functions are fine.
Home also has a button to display more books, which takes you to another page with more books, and there is also a component, for book-list, but one problem is that if you don"t click on a book in Home to enter BookDetail, on the page of more books, you can"t click on BookDetail for each book.
in the end, it is found that it is an on-demand loading pot, so there will be no problem if it is written to load immediately:

turns out to be

const BookDetail = resolve => require(["@/views/BookDetail"], resolve)

what is normal now is

import BookDetail from "../views/BookDetail"

who can tell me how to write
PS: if I want to load on demand? my vue and webpack are both up to date

.

this is lazy loading of routing. The description of the problem is a little vague. I don't know if it's what you want
.
  • declare
const view = (path, name) => () => import(`@/components/${path}${name}`)// 
  • usage
export default new Router({
  routes: [

    {
      path: '/',
      name: 'Index',
      component: view('', 'Index'),
      children: [
        {
          path: '/',
          name: 'Recomend',
          component: view('', 'Recomend')
        }
      ]
    }    
  ]
})
Menu