exports.js 641 B

12345678910111213141516171819202122232425
  1. /*
  2. * @description: 处理自定义远程的组件
  3. * @Date: 2023-06-02 10:18:46
  4. * @Author: xing.heng
  5. * @LastEditors: xing.heng
  6. * @LastEditTime: 2023-06-05 18:39:21
  7. */
  8. const files = require.context('./', true, /index.vue$/)
  9. const remoteComponents = []
  10. files.keys().forEach(key => {
  11. const title = key.split('/')[1].replace('.vue', '')
  12. const img = require(`./${title}/component.png`)
  13. const config = require(`./${title}/config.js`).default
  14. remoteComponents.push({
  15. title: config.title || title,
  16. vueSysComponentDirName: title,
  17. vueFile: files(key).default,
  18. ...config,
  19. img
  20. })
  21. })
  22. export default remoteComponents