这行得通
Template.kanjifinder.kanjicharacters = function () {
console.log("kanjlist");
return kanji.find({cardid: {$in:[1,2]}}, {sort: {cardid: 1}});
};
但是有没有办法[1,2]
用 javascript 数组替换这个硬编码的数组?
var str = "123456"
var cardids = str.split("");
if (Meteor.isClient) {
Template.kanjifinder.kanjicharacters = function () {
console.log("kanjlist");
return kanji.find({cardid: {$in: **cardids** }}, {sort: {cardid: 1}});
}
};