解决layui2.6表格不支持导出
k.exportFile = function (e, t, i) { var d, a, l, c, r = this, s = (t = t || k.clearCacheKey(k.cache[e]), y.that[e]), n = y.config[e] || {}, o = { csv: "text/csv", xls: "application/vnd.ms-excel" }[i = i || "csv"], u = document.createElement("a"); // if (x.ie) // return p.error("IE_NOT_SUPPORT_EXPORTS"); var dString = (d = [], a = [], l = [], c = {}, layui.each(t, function (l, n) { var o = []; "object" == typeof e ? (layui.each(e, function (e, t) { 0 == l && d.push(t || "") }), layui.each(k.clearCacheKey(n), function (e, t) { o.push('"' + (t || "") + '"') })) : k.eachCols(e, function (e, t) { var i, a; t.field && "normal" == t.type && (t.hide ? 0 == l && (c[t.field] = !0) : (i = n[t.field], a = r.layBody.find('tr[data-index="' + l + '"]>td'), null == i && (i = ""), 0 == l && d.push(t.title || ""), o.push('"' + m.call(s, { item3: t, content: i, tplData: n, text: "text", obj: s.commonMember.call(a.eq(0), { td: function (e) { return a.filter('[data-field="' + e + '"]') } }) }) + '"'))) }), a.push(o.join(",")) }), layui.each(r.dataTotal, function (e, t) { c[e] || l.push(t) }), d.join(",") + "\r\n" + a.join("\r\n") + "\r\n" + l.join(",")); u.href = "data:" + o + ";charset=utf-8,\ufeff" + encodeURIComponent(dString); if (x.ie) { var meta = {csv: "text/csv", xls: "application/vnd.ms-excel"}[i];// meta格式 var types = i; navigator.msSaveBlob(new Blob(['\ufeff' + dString], {type: meta + ';charset=utf-8;'}), '导出文件.' + types) } else { u.download = (n.title || "table_" + (n.index || "")) + "." + i, document.body.appendChild(u), u.click(), document.body.removeChild(u) } }