使用 Polymer 入门套件,我试图从 JS 触发路线更改,但无法使其正常工作。尽管路线发生了变化,但在我在浏览器中再次前进和前进后,路线不再被触发(page.js 无法读取读取长度),这是更改路线的正确方法吗?
(function() {
Polymer({
is: 'my-greeting',
properties: {
greeting: {
type: String,
value: 'Enter username',
notify: true
},
pass:{
type:String,
value: '***',
notify: true
}
},
buttonClicked : function(){
this.doLogin();
},
doLogin : function(){
console.log(this.greeting);
app.myFirebaseRef.authWithPassword({
"email": this.greeting,
"password": this.pass
}, function(error, authData) {
if (error) {
console.log("Login Failed!", error);
} else {
// THIS IS IT
app.route = 'users';
history.pushState({customurl:'users'}, null, 'users');
}
});
}
});
})();