基本窗口警报功能在流星中不起作用

Basic Window.alert function not working in Meteor

本文关键字:流星 不起作用 功能 窗口      更新时间:2023-09-26
嗨,我

有一个基本功能,我正在尝试工作。请让我知道您看到它被破坏的任何原因。

'click #addTag': function(event, template) {
var tagTitle = template.find("#AddVideoTags").value;
window.alert(tagTitle);
}

我的猜测是 template.find("#AddVideoTags") 是未定义的,当您尝试访问 .value 时会抛出错误。 我用一些虚拟代码重现了这一点:

'click #addTag': function(event, template) {
    window.alert('This will work');
    var tagTitle = template.find("#ThisDoesNotExist").value; // This throws an exception.
    window.alert(tagTitle); // This will not execute.
}