我通过以下方式在 Meteor 0.9.1.1 中实现了 iCheck:
但 Firebug 告诉我, .iCheck 不是一个函数。
我刚刚添加了 jQuery
Meteor add jquery
所以我想我有它的最新版本,它应该提供.iCheck。还是它使用旧版本的 jQuery?
我通过以下方式在 Meteor 0.9.1.1 中实现了 iCheck:
但 Firebug 告诉我, .iCheck 不是一个函数。
我刚刚添加了 jQuery
Meteor add jquery
所以我想我有它的最新版本,它应该提供.iCheck。还是它使用旧版本的 jQuery?
这就是我让它工作的方式:
iCheck-master从 github 存储库下载并解压缩。icheck.js到client/lib/client/config/(例如skins/flat/red.css:)public/img/icheck/(例如:skins/flat/red.png,skins/flat/red@2x.png)red.png为/img/icheck/red.png完成此操作后,您现在可以iCheck像这样在您的应用程序中使用:
client/views/icheck-test/icheck-test.html
<template name="icheck_test">
<label>
<input type="checkbox" name="foo">
Foo
</label>
</template>
client/views/icheck-test/icheck-test.js
Template.icheck_test.rendered=function(){
this.$("input").iCheck({
checkboxClass: "icheckbox_flat-red",
radioClass: "iradio_flat-red"
});
};
可以重复此过程以在 Meteor 中集成几乎任何 jQuery 插件。我们也可以使用包,但目前自定义包以选择特定主题有点棘手。