search

Home  >  Q&A  >  body text

Can java return the following fields?

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')  
  }
]
为情所困为情所困2727 days ago619

reply all(3)I'll reply

  • 怪我咯

    怪我咯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.

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-06-12 09:27:47

    Change your thinking, it’s too forced

    reply
    0
  • PHP中文网

    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

    reply
    0
  • Cancelreply