使用Hbuilder时,引入js文件一直不成功

因为我在request.js中定义了一个对象,对象中又有一个对象和一个方法,但是我在对象和方法之间没有写逗号,导致这个js文件一直引入不到index.js中,但是request.js中并没有报错,所有我也一直没有检查其中的内容,一直以为是路径错了

var RequestUrl={
	 baseURL : GLOBAL_URL,
	 API:{
	 	PROCLAMATION:'/api/proclamation',
	 },
	  constructURL : function (apiKey, restMethod, paramObj) {
        var _paramURL = "";
        if (arguments.length < 1) {
            console.log("此函数必须有一个参数");
            return "";
        }
        if (!this.API.hasOwnProperty(apiKey)) {
            console.log("apiKey输入错误,请在RequestUrl的API属性中找到具体的定义");
            return "";
        }
        if (paramObj) {
            if (paramObj instanceof Object) {
                for (o in paramObj) {
                    if (_paramURL == "") {
                        _paramURL = "?" + o + "=" + paramObj[o];
                    } else {
                        _paramURL += "&" + o + "=" + paramObj[o];
                    }
                }
                _paramURL = this.baseURL + this.API[apiKey] + (restMethod === "" ? "" : "/" + restMethod) + _paramURL;
            } else {
                console.log("参数应该为一个object");
            }
        } else {
            _paramURL = this.baseURL + this.API[apiKey] + (restMethod === "" ? "" : "/") + restMethod;
        }
        return _paramURL;
    },
}

猜你喜欢

转载自blog.csdn.net/weixin_42424269/article/details/86537847
今日推荐