在Windows 10的IE11中,我得到了Object doesn't support property or method 'includes' error on Cookie.set('something', null)
。以前我有Cookie.remove('something')
而且出现了同样的错误。
Cookie = require('js-cookie')
Cookies.set('save_lead', null)
// used to be:
// Cookies.remove('save_lead')
答案 0 :(得分:1)
我使用array-includes npm包找到了解决方法。乍一看,看起来它只是给你一个替换来调用arr.includes('foo')
,但它也允许一个垫片。
来自github自述文件:
var includes = require('array-includes');
var assert = require('assert');
/* when Array#includes is not present */
delete Array.prototype.includes;
var shimmedIncludes = includes.shim();
assert.equal(shimmedIncludes, includes.getPolyfill());
assert.deepEqual(arr.includes('foo', 1), includes(arr, 'foo', 1));
希望它可以帮助他人。