Vue loads the template with variables. No, you can write it yourself.

as shown in the figure, variable, no

     datas.forEach(item => {
                let newRoute = {
                  path: item.path,
                  name: item.name,
                  meta: {
                    title: item.title,
                    hideInMenu: false
                  },
                  component: (resolve) => require(["@" + item.componentPath], resolve)
                }
                // newRoute.component = () => import(`@/${item.componentPath}`)
                // console.info("path ", () => import(`@/${item.componentPath}`))
                if (item.children.length > 0) {
                  newRoute.children = makeRouter(item.children, newRoute)
                }

                store.push(newRoute)
              })

clipboard.png

:


clipboard.png

clipboard.png

Jul.12,2021

it is not possible to add variables directly to require .

if you are built by webpack, try require.context

The

stamp is detailed here: ides/dependency-management.html-sharprequirecontext" rel=" nofollow noreferrer "> require.context

your project directory file structure is not familiar here, so I'll give you a direction. You can refer to section 7 of this article

. The path of

variable splicing is not the same as the path you wrote to death. Should I tell you quietly ~

?
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e43fc7-59ac9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e43fc7-59ac9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?