区分环境登陆(避免代码冗长)

 1 export const Env = {
 2 };
 3 export function getEnv(hostName) {
 4   if (xxx.test(hostName)) {
 5     return '环境'
 6   } 
 7 }
 8 
 9 class Config {
10  constructor(env){}//它的工作是保证每个对象的数据成员具有合适的初始值
11  getmethods(){}//自定义方法
12 }
13 
14 export default new Config(getEnv(document.domain));

 

posted @ 2020-04-16 20:18  文刂刂  阅读(124)  评论(0)    收藏  举报