My front-end development will now use background data. I would like to ask if I can return the following fields, where require is a function, and it can be executed if I get it
permission: [
{
path: '/index',
name: 'index',
component: require('./../views/layout/index')
}
]
This is not a standard JSON data format.
Why not return:
Then
require
is processed based on thecomponent
field.Change your thinking, it’s too forced
Either process the data in the background and format it into json, or return the json data to the front desk for parsing and processing. The idea of installing an operation in the data is indeed a bit difficult to understand. You must distinguish the data and operations and do not mix them together. Even if it works Yes, the coupling is too strong