app.js错误:
TypeError: Cannot read property 'userAgent'ofundefined
at vendor.js? [sm]:19915
at Object._ (vendor.js? [sm]:19913)
at __webpack_require__ (runtime.js? [sm]:92)
at Object.<anonymous> (main.js? [sm]:14)
at Object.<anonymous> (main.js? [sm]:44)
at __webpack_require__ (runtime.js? [sm]:92)
at checkDeferredModules (runtime.js? [sm]:48)
at Array.webpackJsonpCallback [as push] (runtime.js? [sm]:35)
at main.js? [sm]:1
at p (VM1604 WAService.js:2)
两年了还是这个问题,还没解决方案
没有使用vant为啥会报这个错啊,前几天还能跑的,现在跑不起来了
解决了吗
+1
app.js错误: TypeError: Cannot read property 'userAgent' of undefined at vendor.js? [sm]:19915 at Object._ (vendor.js? [sm]:19913) at __webpack_require__ (runtime.js? [sm]:92) at Object.<anonymous> (main.js? [sm]:14) at Object.<anonymous> (main.js? [sm]:44) at __webpack_require__ (runtime.js? [sm]:92) at checkDeferredModules (runtime.js? [sm]:48) at Array.webpackJsonpCallback [as push] (runtime.js? [sm]:35) at main.js? [sm]:1 at p (VM1604 WAService.js:2)
于是我找到报错位置,尝试了一下 加了个return;
结果就好了QWQ
(function () {
return;
var u = navigator.userAgent,
w = window.innerWidth;
var p = 1920;
if (w > 1920) {
p = 3840;
}
if (!u.match(/AppleWebKit.*Mobile.*/) || u.indexOf('iPad') > -1) {
window.innerWidth = 750 * (w / p);
window.onload = function () {
window.innerWidth = w; // document.getElementsByTagName('html')[0].style = 'background-color:#000;';
// document.getElementsByTagName('body')[0].style = 'width:750px;position: relative;left: 50%;transform: translateX(-50%);';
// document.getElementsByClassName('uni-page-head')[0].style = 'width:750px;left: 50%;transform: translateX(-50%);background-color: rgb(0, 129, 255);';
// document.getElementsByClassName('uni-tabbar')[0].style = 'width:750px;margin:0 auto;left: 50%;transform: translateX(-50%);background-color: rgb(255, 255, 255);';
};
}
})();
解决了没楼主,也是用vant报这个错,孩子快哭了都
你解决了吗
大佬问题解决了吗?我也是用了vant后就出这个报错
这个问题解决了吗,我也遇到了,我是因为在自定义app.js上引入了vant,在页面内引入没有问题,现在也在找解决办法。
是h5页面写了判断userAgent是么。