devject-design 0.1.1 → 0.1.2
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 +35 -0
- package/dist/index.es.js +1275 -1242
- package/dist/index.umd.js +1 -1
- package/dist/pages/FormDesigner.d.ts +6 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,6 +35,41 @@ npm install vue element-plus
|
|
|
35
35
|
npm install xlsx
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
## 环境变量配置
|
|
39
|
+
|
|
40
|
+
本库支持通过环境变量配置上传和下载接口。由于这是一个 npm 包,你需要在使用此包的宿主工程(Host Project)的构建配置中注入这些变量。
|
|
41
|
+
|
|
42
|
+
### 变量说明
|
|
43
|
+
|
|
44
|
+
| 变量名 | 说明 | 默认值 |
|
|
45
|
+
| :--- |:---------------------------------------------| :--- |
|
|
46
|
+
| `VITE_DEVJECT_UPLOAD_URL` | 文件上传接口地址 | |
|
|
47
|
+
| `VITE_DEVJECT_DOWNLOAD_URL` | 文件下载/访问基础路径 | |
|
|
48
|
+
| `VITE_DEVJECT_UPLOAD_PARSE` | 上传响应解析路径 (例如 `data.url`,即为response.data.url) | `data` |
|
|
49
|
+
|
|
50
|
+
### 在 Vite 项目中配置
|
|
51
|
+
|
|
52
|
+
在你的 `vite.config.ts` 中使用 `define` 选项注入这些变量:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { defineConfig, loadEnv } from 'vite'
|
|
56
|
+
|
|
57
|
+
export default defineConfig(({ mode }) => {
|
|
58
|
+
// 加载环境变量
|
|
59
|
+
const env = loadEnv(mode, process.cwd(), '')
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
define: {
|
|
63
|
+
// 注入环境变量供 devject-design 使用
|
|
64
|
+
'process.env.VITE_DEVJECT_UPLOAD_URL': JSON.stringify(env.VITE_DEVJECT_UPLOAD_URL),
|
|
65
|
+
'process.env.VITE_DEVJECT_DOWNLOAD_URL': JSON.stringify(env.VITE_DEVJECT_DOWNLOAD_URL),
|
|
66
|
+
'process.env.VITE_DEVJECT_UPLOAD_PARSE': JSON.stringify(env.VITE_DEVJECT_UPLOAD_PARSE),
|
|
67
|
+
},
|
|
68
|
+
// ... 其他配置
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
```
|
|
72
|
+
|
|
38
73
|
## 快速开始
|
|
39
74
|
|
|
40
75
|
### 引入样式
|