I dynamically added a route and then an error was reported. The code for adding dynamic routing is as follows. Data is the data obtained from the background. I wrote a 404 page myself, and path: '/404' did not have this error.
data.permission = [{
path: '/index',
name: 'index',
component: './../views/layout/index'
}]
this.$router.addRoutes(data.permission)
Then the following error is reported, please solve it
Uncaught (in promise) Error: [vue-router] route config "component" for path: /index cannot be a string id. Use an actual component instead.
Add a require in the component field, the error message was misunderstood
component requires a component instance and cannot give a path
It can be introduced through import or require