Browse Source

添加注释

任一存 3 years ago
parent
commit
8f32a6c74d

+ 2 - 0
new_backstage/src/configue/http.js

@@ -8,8 +8,10 @@ const vue = new Vue();
 var isProduction = process.env.NODE_ENV === "production";
 let loading = "";
 
+// 后端的baseUrl
 const serverName = isProduction ? "/" : "http://192.168.0.135:8004/";
 
+// 前端域名或IP,没用到。
 const serverLocation = window.location.hostname;
 
 axios.defaults.baseURL = serverName;

+ 1 - 0
new_backstage/src/main.js

@@ -3,6 +3,7 @@ import App from './App.vue'
 import router from './router'
 
 import ElementUI from 'element-ui';
+// 会被下面的导入文件覆盖吧?
 import 'element-ui/lib/theme-chalk/index.css';
 import '../theme/index.css'
 import './mixins'

+ 8 - 1
new_backstage/src/util/listener.js

@@ -5,11 +5,16 @@
  * @LastEditTime: 2020-04-03 12:02:39
  * @Description: 启动器
  */
-
+/**
+ * 用处是什么?
+ * _promise: 外界调用register,从而把本对象作为参数执行了callback,应该得到一个Promise对象,存起来。
+ * _resolve: 外界通过resolve方法传入的,应该是Promise的resolve方法。
+ */
 class Detector {
   constructor() {
       this._resolve = null
   }
+  // 把本对象作为参数执行了callback,应该得到一个Promise对象,存起来。
   register(callback) {
       this._promise = callback(this)
   }
@@ -19,9 +24,11 @@ class Detector {
       }
       return this._promise
   }
+  // 把保存的Promise对象resolve掉。
   valid() {
       this._resolve && this._resolve()
   }
+  // 存入resolve。外界调用register时传入的参数函数会new一个Promise对象并调用此方法,从而本对象内部就保存了Promise对象和它的resolve方法。
   resolve(resolve) {
       this._resolve = resolve
   }