@mingfuyun/star-allinone 0.0.2 → 0.0.4
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/README.md +24 -0
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +0 -68
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -263,6 +263,23 @@ HocModal会将你的组件包装,并注入以下props:
|
|
|
263
263
|
|
|
264
264
|
适用于需要动态控制显示/隐藏,并且需要传递参数的Modal场景。
|
|
265
265
|
|
|
266
|
+
#### ⚠️ 常见错误
|
|
267
|
+
|
|
268
|
+
**错误用法**:
|
|
269
|
+
```tsx
|
|
270
|
+
// ❌ 错误:HocModal 是一个高阶组件,不能直接作为组件使用
|
|
271
|
+
<HocModal />
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**正确用法**:
|
|
275
|
+
```tsx
|
|
276
|
+
// ✅ 正确:先使用 HocModal 包装你的组件
|
|
277
|
+
const WrappedModal = HocModal(MyContent);
|
|
278
|
+
<WrappedModal ref={modalRef} />
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**注意**:`HocModal` 是一个函数,接受一个组件作为参数,返回一个新的包装组件。不能直接作为 React 组件使用。
|
|
282
|
+
|
|
266
283
|
### CustomDrawer 自定义抽屉
|
|
267
284
|
|
|
268
285
|
基于Antd Drawer的增强组件,提供统一的样式和默认配置,支持自定义底部操作栏。
|
|
@@ -425,6 +442,13 @@ function Page() {
|
|
|
425
442
|
- Antd >= 5.27.3
|
|
426
443
|
- cron-validator >= 1.4.0 (用于Cron表达式验证)
|
|
427
444
|
|
|
445
|
+
**重要提示**:组件库使用 `peerDependencies` 管理 React 和 Antd,确保你的项目中已安装这些依赖。如果遇到 "Invalid hook call" 错误,请检查:
|
|
446
|
+
|
|
447
|
+
1. 确保项目中只安装了一个 React 版本
|
|
448
|
+
2. 确保 React 和 React-DOM 版本匹配
|
|
449
|
+
3. 如果使用 npm/yarn,可以尝试删除 `node_modules` 和锁文件后重新安装
|
|
450
|
+
4. 如果使用 pnpm,确保在 `.npmrc` 中配置了 `shamefully-hoist=true` 或使用 `public-hoist-pattern[]=*react*`
|
|
451
|
+
|
|
428
452
|
## 🔧 开发
|
|
429
453
|
|
|
430
454
|
### 本地开发
|