Answer the question
In order to leave comments, you need to log in
Why is the view not reloading?
Wrote the simplest website, which consists of three pages. Each page has its own view, the router draws the corresponding view depending on the state of the address bar.
router:
const Router = Backbone.Router.extend({
routes: {
'': 'page1',
'page1': 'page1',
'page2': 'page2',
'page3': 'page3',
},
page1() {
app.showView(pageView1);
},
page2() {
app.showView(pageView2);
},
page3() {
app.showView(pageView3);
}
});
const router = new Router()
const PageView = View.extend();
const pageView1 = new PageView({
template: _.template('<h1>qwerty <%= header %></h1>'),
model: pageModel1,
});
const pageView2 = new PageView({
template: _.template('<h1>qwerty <%= header %></h1>'),
model: pageModel2,
});
const pageView3 = new PageView({
template: _.template('<h1>qwerty <%= header %></h1>'),
model: pageModel3,
});
Uncaught constructor {name: "RegionError", message: "View (cid: "view5") has already been destroyed and cannot be used.", url: " marionettejs.com/docs/v4.1.2/marionette.region.htm. .. ", stack: "RegionError: View (cid: "view5") has already been …x/libs/ backbone.js/1.4.0/backbone-min.js:1:23438 )"}
An error will be thrown if the view is falsy or destroyed.
An error will be thrown if the view is already shown in a Region
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question