这个方法似乎有些不对劲。安装“insecure”时,方法中的代码工作得很好。谢谢!
Uncaught SecurityError: Blocked a frame with origin "http://localhost:3000" from accessing a frame with origin "chrome-extension://oknpjjbmpnndlpmnhmekjpocelpnlfdi". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "chrome-extension". Protocols must match.
模板事件
Template.docEdit.events({
'click .remove': function(event, template) {
var thisTag = String(this);
Meteor.call('removeTag', template, thisTag);
},
});
方式
Meteor.methods({
removeTag: function(template, thisTag) {
MyPix.update (
template.data._id,
{ $pull: { 'metadata.tags': thisTag }}
);
}
})
这确实适用于“不安全”添加
Template.docEdit.events({
'click .remove': function(event, template) {
var thisTag = String(this);
MyPix.update (
template.data._id,
{ $pull: { 'metadata.tags': thisTag }}
);
}
});
答案 0 :(得分:1)
好的,我正在传递整个模板。该方法只需要id。
模板事件
Template.docEdit.events({
'click .remove': function(event, template) {
var thisTag = String(this);
var thisId = template.data._id; // assign id to var
Meteor.call('removeTag', thisId, thisTag);
},
});
方式强>
Meteor.methods({
removeTag: function(thisId, thisTag) {
MyPix.update (
thisId,
{ $pull: { 'metadata.tags': thisTag }}
);
},
})