UniappComponent.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace core\dict;
  12. class UniappComponent extends BaseDict
  13. {
  14. /**
  15. * 系统uniapp组件配置
  16. * @param array $data
  17. * @return array|mixed
  18. */
  19. public function load(array $data)
  20. {
  21. $addons = $this->getLocalAddons();
  22. $components_files = [];
  23. foreach ($addons as $v) {
  24. $components_path = $this->getAddonDictPath($v) . "diy" . DIRECTORY_SEPARATOR . "components.php";
  25. if (is_file($components_path)) {
  26. $components_files[] = $components_path;
  27. }
  28. }
  29. $components_files_data = $this->loadFiles($components_files);
  30. $components = $data;
  31. foreach ($components_files_data as $file_data) {
  32. $components = empty($components) ? $file_data : array_merge2($components, $file_data);
  33. }
  34. return $components;
  35. }
  36. }