Solutions:
For more details, see gitee.com/mayanze123/…
Properties partially resolved before:
component: () => import(‘@/views/’ + menu.url),
After the property part is resolved:
component(resolve) { require([‘@/views/’ + menu.url], resolve) },
Complete code screenshot:
Variable part:
tmpc.component = resolve => require.ensure([], () => resolve(require(‘@/views/’ + child.url)))
Cause and effect:
The reason was that I was going to write a project of my own using vue-element-admin, PanJiaChen’s open source framework for the front-end. I wanted to change the menu part into my own back-end database menu, and then assembled the route from the background data according to the existing route, but it didn’t work.
After countless times trying to break the keyboard, the last bit of rationality told me that doing that would not solve the problem two days later, a whim to put the dynamic part
Component: () => import('@/views/house/index') component: () => import('@/views/house/index')Copy the code
Later, was good, I go to a query information found on the Internet, this way is not allowed to use the variable (small white one, a great god never), but the problem is coming, since is the database with data assembly, this part of the variable cannot be avoided, a variety of ways on the Internet after the trial, found the solution, is the solution