vue+iview 兼容IE11浏览器的实现方法(2)

var load = function (name, addOnUrl, success, scope, failure) { if (urls[name]) { return; } var urlString = typeof addOnUrl === 'string' ? addOnUrl : addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix; if (urlString.indexOf('https://www.jb51.net/') !== 0 && urlString.indexOf('://') === -1) { // 兼容IE 浏览器 // 在load函数中,需要判断 当前浏览器,然后加上 dist urlString = AddOnManager.baseURL + 'dist/' + urlString; console.log(urlString) } urls[name] = urlString.substring(0, urlString.lastIndexOf('https://www.jb51.net/')); if (lookup[name]) { loadDependencies(name, addOnUrl, success, scope); } else { ScriptLoader.ScriptLoader.add(urlString, function () { return loadDependencies(name, addOnUrl, success, scope); }, scope, failure); } }; var loadLanguage = function (scriptLoader, editor) { var settings = editor.settings; if (settings.language && settings.language !== 'en' && !settings.language_url) { // 兼容IE浏览器 if (window.navigator.userAgent.indexOf('Trident') > 0) { settings.language_url = editor.editorManager.baseURL + '/dist/langs/' + settings.language + '.js'; } else { settings.language_url = editor.editorManager.baseURL + '/langs/' + settings.language + '.js'; } } if (settings.language_url && !editor.editorManager.i18n.data[settings.language]) { scriptLoader.add(settings.language_url); } };

Theme.js

var getSkinUrl = function (editor) { var settings = editor.settings; var skin = settings.skin; var skinUrl = settings.skin_url; if (skin !== false) { var skinName = skin ? skin : 'lightgray'; if (skinUrl) { skinUrl = editor.documentBaseURI.toAbsolute(skinUrl); } else { // 兼容IE 浏览器 if (window.navigator.userAgent.indexOf('Trident') > 0) { skinUrl = EditorManager.baseURL + '/dist/skins/' + skinName; } else { skinUrl = EditorManager.baseURL + '/skins/' + skinName; } } } return skinUrl; };

8、导出excel文件

其实我是倾向于使用 iview 自带的 exportCsv 的,但是 其

不会执行 columns 里的render、

导出的数字 0002 打开会变成 2

。。。

很多问题,没办法,这个文件天生的,避免不了

IE 的话,又不兼容 download属性、我的系统又说什么阻止了正向与反向缓存什么的,点进去还蛮多符合的东西的,结果window.href 也gg,只能使用 msSaveBlob 了

// 兼容IE if (window.navigator.msSaveOrOpenBlob) { const blob = new Blob([template], {type: "application/vnd.ms-excel"}) navigator.msSaveBlob(blob, this.name.indexOf('xls') > 0 ? this.name : this.name + '.xls'); } else { let link = document.createElement('a'); link.href = uri + this.base64(template); link.download = this.name.indexOf('xls') > 0 ? this.name : this.name + '.xls'; link.click(); }

9、复制粘贴失效!?

测试和我说复制粘贴失效了,我整个人差点爆炸!

冷静一点...

分析一下:在IE中,复制之后会将回车复制进去,然后黏贴到input标签时,只展示第一行

//监听 paste事件 MyPaste () { if (window.navigator.userAgent.indexOf('Trident') > 0) { var copyText = window.clipboardData.getData("Text"); this.filters.phoneNum = this.filters.phoneNum ? this.filters.phoneNum + copyText.replace(/[\r\n]/g,"") : copyText.replace(/[\r\n]/g,""); } }, ...

还有好多,但是就不一一讲了,其他的应该能查到,byebye

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/5503cd9716220f423aaec153694d9184.html