py-test-component 1.0.8 → 1.0.10

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "py-test-component",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Vue2 + ElementUI 组件库,支持 React 使用",
5
5
  "main": "dist/py-component.js",
6
6
  "module": "dist/py-component.esm.js",
@@ -22,13 +22,14 @@ let isLoaded = false;
22
22
 
23
23
  /**
24
24
  * 加载组件库核心逻辑
25
- * 使用 ESM 动态导入,由构建工具处理路径解析
25
+ * 动态加载 UMD 构建产物,避免循环依赖
26
26
  */
27
27
  async function doLoad() {
28
28
  if (typeof window === 'undefined') return null;
29
29
  if (window.PyComponent) return window.PyComponent;
30
30
 
31
- const module = await import('py-test-component');
31
+ // 使用相对路径加载构建产物,支持 Webpack/Vite 等构建工具解析
32
+ const module = await import('../../dist/py-component.esm.js');
32
33
  const PyComponent = module.default || module;
33
34
 
34
35
  if (PyComponent && typeof window !== 'undefined') {
@@ -94,7 +95,7 @@ export const PyTable = forwardRef(function PyTable({ data, loading: propsLoading
94
95
 
95
96
  useEffect(() => {
96
97
  if (elRef.current && data && loaded) {
97
- // 直接设置 property,比 setAttribute 更可靠
98
+ // 直接设置 property,避免 JSON 序列化/反序列化开销
98
99
  elRef.current.tableData = data;
99
100
  }
100
101
  }, [data, loaded]);