gpt4 book ai didi

javascript - new 而不是 Object.create

转载 作者:行者123 更新时间:2023-11-28 20:15:53 26 4
gpt4 key购买 nike

通常我会这样做:

$.fn.MYPL = function (options) {
return this.each(function () {
myplg = Object.create(MYPL);
myplg.init(options, this);
});
};

Object.create 在 IE6、IE7 和 IE8 中不受支持。我刚刚意识到,我可以用 new 替换 Object.create像:

var g = new Graph();

但我不知道..如何更改我的插件定义?

我已经尝试过:

var myplg = new MYPL();

但是它不起作用。任何帮助表示赞赏。

最佳答案

您可以polyfill Object.create这样您就可以在 IE7 和 IE8 中使用它。

关于javascript - new 而不是 Object.create,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19197327/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com