ydcss / vue-ydui

A mobile components Library with Vue2.js. 一只基于Vue2.x的移动端组件库。
http://vue.ydui.org
MIT License
2.75k stars 559 forks source link

设备侦测 Cannot set property 'device' of undefined #715

Closed maopixin closed 5 years ago

maopixin commented 5 years ago

我是用的是jq版本的, 因为我是一名小前端,啥都不懂,在我的项目里面是用的smarty模板写的 先引入了一段这样的js ···· var require, define; !function(e) { function r(e, r) { function t() { clearTimeout(o) } if (!(e in u)) { u[e] = !0; var i = document.createElement("script"); if (r) { var o = setTimeout(r, require.timeout); i.onerror = function() { clearTimeout(o), r() } , "onload"in i ? i.onload = t : i.onreadystatechange = function() { ("loaded" == this.readyState || "complete" == this.readyState) && t() } } return i.type = "text/javascript", i.src = e, n.appendChild(i), i } } function t(e, t, n) { var o = i[e] || (i[e] = []); o.push(t); var a, u = s[e] || {}, f = u.pkg; a = f ? c[f].url : u.url || e, r(a, n && function() { n(e) } ) } var n = document.getElementsByTagName("head")[0] , i = {} , o = {} , a = {} , u = {} , s = {} , c = {}; define = function(e, r) { o[e] = r; var t = i[e]; if (t) { for (var n = 0, a = t.length; a > n; n++) t[n](); delete i[e] } } , require = function(e) { e = require.alias(e); var r = a[e]; if (r) return r.exports; var t = o[e]; if (!t) throw "[ModJS] Cannot find module " + e + ""; r = a[e] = { exports: {} }; var n = "function" == typeof t ? t.apply(r, [require, r.exports, r]) : t; return n && (r.exports = n), r.exports } , require.async = function(r, n, i) { function a(e) { for (var r = 0, n = e.length; n > r; r++) { var c = e[r]; if (c in o) { var f = s[c]; f && "deps"in f && a(f.deps) } else if (!(c in l)) { l[c] = !0, p++, t(c, u, i); var f = s[c]; f && "deps"in f && a(f.deps) } } } function u() { if (0 == p--) { for (var t = [], i = 0, o = r.length; o > i; i++) t[i] = require(r[i]); n && n.apply(e, t) } } "string" == typeof r && (r = [r]); for (var c = 0, f = r.length; f > c; c++) r[c] = require.alias(r[c]); var l = {} , p = 0; a(r), u() } , require.resourceMap = function(e) { var r, t; t = e.res; for (r in t) t.hasOwnProperty(r) && (s[r] = t[r]); t = e.pkg; for (r in t) t.hasOwnProperty(r) && (c[r] = t[r]) } , require.loadJs = function(e) { r(e) } , require.loadCss = function(e) { if (e.content) { var r = document.createElement("style"); r.type = "text/css", r.styleSheet ? r.styleSheet.cssText = e.content : r.innerHTML = e.content, n.appendChild(r) } else if (e.url) { var t = document.createElement("link"); t.href = e.url, t.rel = "stylesheet", t.type = "text/css", n.appendChild(t) } } , require.alias = function(e) { return e } , require.timeout = 5e3 }(this); ··· 如果去掉这段代码或者放在ydui.js后面引用 ,都是可以的,只要在前面引入这个js 就会报错 能否劳烦大牛牛给看下,实在看不懂。嘤嘤嘤

maopixin commented 5 years ago

找了一下 这个文件是做模块化的 https://github.com/zjcqoo/mod ,但我还是不知道为什么会有冲突

maopixin commented 5 years ago

目前已经暂时解决了 , 我没有使用这个mod js引入方法。是ok 的