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')
}
]
怪我咯2017-06-12 09:27:47
This is not a standard JSON data format.
Why not return:
permission: [
{
path: '/index',
name: 'index',
component: './../views/layout/index'
}
]
Then require
is processed based on the component
field.
PHP中文网2017-06-12 09:27:47
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