@mayaxxp/cueui 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26642,19 +26642,27 @@ const components = [Select/* default */.A, Table/* default */.A, DynTable, ListS
26642
26642
  // DragButton
26643
26643
  ];
26644
26644
  const packages_install = function (Vue, options) {
26645
+ if (packages_install.installed) return;
26646
+ // 创建一个新的组件数组副本
26647
+ let allComponents = [...components]; // 不要直接修改原数组
26645
26648
  if (options && options.components) {
26646
- components = [...components, ...options.components];
26649
+ allComponents = [...allComponents, ...options.components]; // 使用副本进行扩展
26647
26650
  }
26648
26651
  if (options.axios) {
26649
26652
  Vue.prototype.$cuRequest = options.axios;
26650
26653
  }
26651
26654
  Vue.use(dic, options);
26652
26655
  // 循环全局注册组件
26653
- components.forEach(item => {
26654
- if (item.name) {
26655
- item.name = "Cu" + item.name;
26656
- }
26657
- Vue.component(item.name, item);
26656
+ allComponents.forEach(item => {
26657
+ // 修改组件命名逻辑,确保组件名称正确
26658
+ let componentName = item.name;
26659
+ if (componentName && !componentName.startsWith('Cu')) {
26660
+ componentName = "Cu" + componentName;
26661
+ } else if (!componentName) {
26662
+ // 如果组件没有定义name属性,从组件导出获取
26663
+ componentName = item.__file ? 'Cu' + item.__file.split('/').pop().replace('.vue', '') : 'CuComponent';
26664
+ }
26665
+ Vue.component(componentName, item);
26658
26666
  });
26659
26667
  };
26660
26668