@ray-js/smart-ui 2.4.0-beta-4 → 2.4.0-beta-6

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.
Files changed (2) hide show
  1. package/README-zh_CN.md +20 -0
  2. package/package.json +1 -1
package/README-zh_CN.md CHANGED
@@ -38,6 +38,26 @@ export default function Demo() {
38
38
  }
39
39
  ```
40
40
 
41
+ ## 动态按需引入(推荐)
42
+ 考虑到项目的按需引入以及整体体积问题,上面的引入方式会导致部分组件样式文件残留影响打包产物体积,所以我们推荐使用按需引入插件,其会自动将 `import { Button } from '@ray-js/smart-ui';` 引入方式解析成 `import Button from '@ray-js/smart-ui/es/button';`。
43
+
44
+ 1. 环境要求
45
+ * \>= @ray-js/cli@1.7.4
46
+ * esbuild 构建模式 (不支持 webpack 模式)
47
+ * 使用 ESModule import 语法的导入
48
+
49
+ 2. 在项目文件 ray.config.ts 内引入 SmartUIAutoImport 即可:
50
+ ```ts
51
+ import { RayConfig } from '@ray-js/types';
52
+ import SmartUIAutoImport from '@ray-js/smart-ui/lib/auto-import';
53
+
54
+ const config: RayConfig = {
55
+ ...
56
+ importTransformer: [SmartUIAutoImport],
57
+ };
58
+ module.exports = config;
59
+ ```
60
+
41
61
  ## 在开发者工具中预览
42
62
 
43
63
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/smart-ui",
3
- "version": "2.4.0-beta-4",
3
+ "version": "2.4.0-beta-6",
4
4
  "description": "轻量、可靠的智能小程序 UI 组件库",
5
5
  "scripts": {
6
6
  "syncMiniappData": "node ./build/syncMiniappData.js",