YZProjectCloud/yanzhu-ui-app/miniprogram/utils/CONFIG_SYNC.md

47 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 配置文件同步说明
## 概述
由于小程序的技术限制WXS 模块无法直接引入 JS 配置文件,因此需要维护两套配置文件:
- `config.js` - 用于逻辑层JS
- `config.wxs` - 用于视图层WXS
## 同步规则
当需要修改配置时,请确保同时更新两个文件中的相应配置项:
### 1. Base URL 配置同步
#### JS 配置文件 (config.js)
```javascript
module.exports = {
// ...
baseImgUrl: "https://jaszpt.crfeb.com.cn",
// ...
};
```
#### WXS 配置文件 (utils/config.wxs)
```javascript
var config = {
baseImgUrl: "https://jaszpt.crfeb.com.cn",
};
module.exports = config;
```
## 维护建议
1. 修改配置时,请同时更新两个文件中的对应项
2. 建议在修改后进行充分测试,确保两个配置文件的一致性
3. 可以通过代码审查来确保配置同步
## 注意事项
- 不要删除 config.js它是整个应用的核心配置文件
- WXS 配置文件仅包含视图层需要的简单配置项
- 复杂的配置逻辑应保留在 config.js 中