在別的js中引入'use strict';var _mm = require('util/mm.js');編寫的_mm的模塊'use strict';var _mm = {// 網絡請求? request : function(param){? var _this = this;? ? ?$.ajax({? ? ? ? type ? ? : param.method || 'get',? ? ? ?url ? ? ?: param.url ? ?|| ?'',?? ? ? ? dataType : param.type ? || 'json',? ? ? ? data ? ? : param.data ? || '',? ? ? ? success ?: function(res){? ? ? ? // 請求成功? ? ? ? ? ? ? if(0 === res.status){? ? ? ? ? ? ? typeof param.success === 'function' && param.success(res.data,res.msg);? ? ? ? ? ? ? }? ? ? ? ? ? ? // 沒有登錄狀態(tài),需要強制登錄? ? ? ? ? ? ? else if(10 === res.status){? ? ? ? ? ? ? ? ? ?_this.doLogin();? ? ? ? ? ? ? }? ? ? ? ? ? ? // 請求數(shù)據錯誤? ? ? ? ? ? ? else if(1 === res.status){? ? ? ? ? ? ? ? typeof param.error === 'function' && param.error(res.msg);? ? ? ? ? ? ? }? ? ? ? },? ? ? ? error ? ?: function(err){? ? ? ? ? typeof param.error === 'function' && param.error(err.statusText);? ? ? ? }? ? ?});? },? //統(tǒng)一登錄處理? doLogin : function(){? window.location.href = './login.html?redirect=' + encodeURIComponent(window.location.href);? }};module.exports = _mm;總是報這樣的錯誤
webpack引用路徑出錯的了嗎
qq_時光如梭_03147320
2017-08-16 09:49:54