我正在通过骨干开发应用程序,但现在出现同样的错误:
Uncaught TypeError: Object function (){ parent.apply(this, arguments); } has no method 'match'
当我添加调用新 Signupview 时,此错误开始出现:
define(["jQuery", "underscore", "Backbone", "Handlebars", "models/person", "views/signupview", "text!templates/loginview.html"], function ($, _, Backbone, Handlebars, Signupview, template) {
var LoginView = Backbone.View.extend({
template: Handlebars.compile(template),
events: {
"click .sign_up": "signUp_manual"
},
initialize: function () {
this.render();
},
render: function () {
var html = this.template();
$('#pagina').html(this.$el.html(html)); //appendo ad el);
return this;
},
signUp_manual: function () {
console.log("signup");
new Signupview();
}
//inserire funzione per log-in
});
return LoginView;
});
这里是注册视图:
define(["jQuery", "underscore", "Backbone", "Handlebars", "text!templates/signup.html"], function ($, _, Backbone, Handlebars, template) {
var Signupview = Backbone.View.extend({
template: Handlebars.compile(template),
events: {},
initialize: function () {
this.render();
},
render: function () {
var html = this.template();
$('#pagina').html(this.$el.html(html)); //appendo ad el);
return this;
}
});
return Signupview;
});