refactor(modules): 使用IIFE包装模块增强隔离和安全性
- 在web主文件和所有模块文件中添加立即调用函数表达式(IIFE) - 对模块作用域使用'use strict'提高代码规范性和错误检测 - 提升模块代码的封装性,防止全局变量污染 - 维护现有模块接口和导出方式不变 - 优化代码结构,提升可读性和维护性
This commit is contained in:
parent
913f93fabd
commit
37aef35f99
|
|
@ -3,6 +3,9 @@
|
|||
* @description 使用模块化架构重构,提升可读性和扩展性
|
||||
*/
|
||||
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
const { createApp, reactive } = Vue;
|
||||
|
||||
// ==================== 模块引用 ====================
|
||||
|
|
@ -907,3 +910,5 @@ const app = createApp({
|
|||
|
||||
app.use(ElementPlus);
|
||||
app.mount('#app');
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
* @module api
|
||||
*/
|
||||
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 获取 API 基础地址
|
||||
* @returns {string} API 基础 URL
|
||||
|
|
@ -427,3 +430,5 @@ window.ApiService = {
|
|||
fetchYmtMerchants,
|
||||
fetchYmtActivities
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
* @module config
|
||||
*/
|
||||
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
// ==================== 系统常量 ====================
|
||||
|
||||
/**
|
||||
|
|
@ -319,3 +322,5 @@ window.AppConfig = {
|
|||
// 默认值
|
||||
getDefaultFields
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
* @module fields
|
||||
*/
|
||||
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
// 依赖:AppConfig
|
||||
|
||||
/**
|
||||
|
|
@ -460,3 +463,5 @@ window.FieldsModule = {
|
|||
TreeUtils,
|
||||
fieldsManager
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
* @module state
|
||||
*/
|
||||
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 创建模板表单初始状态
|
||||
* @param {string} [datasource='marketing'] - 数据源
|
||||
|
|
@ -261,3 +264,5 @@ window.StateModule = {
|
|||
resetExportForm,
|
||||
ValidationRules
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
* @module utils
|
||||
*/
|
||||
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 显示消息提示
|
||||
* @param {string} text - 消息内容
|
||||
|
|
@ -185,3 +188,5 @@ window.AppUtils = {
|
|||
debounce,
|
||||
throttle
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in New Issue