<input id="fileSelect" type="file" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" /> For CSV files (.csv), use:
<input type="file" accept=".csv" />For Excel Files 97-2003 (.xls), use:
| <script type="text/javascript"> | |
| var bForcepc | |
| = fGetQuery("dv") == "pc"; | |
| function | |
| fBrowserRedirect(){ | |
| var sUserAgent = navigator.userAgent.toLowerCase(); | |
| var bIsIpad = sUserAgent.match(/ipad/i) == | |
| "ipad"; | |
| var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; | |
| var bIsMidp = sUserAgent.match(/midp/i) == "midp"; |
| <script type="text/javascript"> | |
| if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){ | |
| if(window.location.href.indexOf("?mobile")<0){ | |
| try{ | |
| if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){ | |
| window.location.href="http://shipei.qq.com/index.htm"; | |
| }else if(/iPad/i.test(navigator.userAgent)){ | |
| }else{ | |
| window.location.href="http://shipei.qq.com/simple/s/index/" | |
| } |
| /* | |
| * 参考: https://mp.weixin.qq.com/s/X3s4ysLfwclEOXIuKzOK2g | |
| * | |
| */ | |
| // 将对象的所有属性加上get,set监听,并调用dep函数 | |
| function observe (obj) { | |
| Object.keys(obj).forEach(key => { | |
| let internalValue = obj[key]; | |
| const dep = new Dep(); | |
| Object.defineProperty(obj, key, { |
| //HTML5提供了一个新属性naturalWidth/naturalHeight可以直接获取图片的原始宽高。这两个属性在Firefox/Chrome/Safari/Opera及IE9里已经实现。改造下获取图片尺寸的方法。 | |
| //http://www.w3.org/TR/2011/WD-html5-author-20110705/the-img-element.html#dom-img-naturalwidth | |
| //http://www.w3.org/TR/2011/WD-html5-author-20110705/the-img-element.html#dom-img-naturalheight | |
| function getImgNaturalDimensions(img, callback) { | |
| var nWidth, nHeight; | |
| if (img.naturalWidth) { | |
| nWidth = img.naturalWidth; | |
| nHeight = img.naturalHeight; | |
| } else { |
| // 兼容 requestAnimationFrame 与 setTimeout | |
| function _throttle (fn, time) { | |
| let running = false | |
| let isFrame = false | |
| if (!time) isFrame = true | |
| const getCallback = (self, args) => { | |
| return () => { | |
| fn.apply(self, args) | |
| running = false | |
| } |
| /** | |
| reset.css | |
| author : codedreamfy | |
| */ | |
| html, | |
| body, | |
| p, | |
| ol, | |
| ul, | |
| li, |
| 页面后退路由重新刷新方法 | |
| ```js | |
| // 第一种 | |
| router.beforeEach((to, from, next) => { | |
| if(sessionStorage.getItem("back_url") === to) { | |
| 刷新 | |
| sessionStorage.setItem("back_url", from) | |
| }else { | |
| sessionStorage.setItem("back_url", from) | |
| } |
| var xhrReq = new XMLHttpRequest(); | |
| xhrReq.onreadystatechange = function(){ | |
| var elm = document.getElementById('link1'); | |
| if(xhrReq.status == 200 && xhrReq.readyState == 4) { | |
| elm.href = xhrReq.response.payload.apk_url; | |
| } | |
| } | |
| xhrReq.open('get',url); | |
| xhrReq.responseType = 'json'; | |
| xhrReq.send(); |
| function loadJs(file){ | |
| var scriptTag = document.getElementById('loadScript'); | |
| var head = document.getElementsByTagName('head').item(0); | |
| if(scriptTag) head.removeChild(scriptTag); | |
| script = document.createElement('script'); | |
| script.src = "../js/mi_"+file+".js"; | |
| script.type = 'text/javascript'; | |
| script.id = 'loadScript'; | |
| head.appendChild(script); | |
| } |