我想使用 neon-animated-pages
切换页面
所以我的代码很简单:
<dom-module id="auth-view">
<template>
<style>
</style>
<neon-animated-pages class="neon-container" selected="[[selected]]">
<login-page></login-page>
<pwd-reset-page></pwd-reset-page>
</neon-animated-pages>
</template>
</dom-module>
在 dart 代码中:
@property
int selected = 0;
StreamSubscription _clickSubscription;
attached() {
_clickSubscription = this.on['showPwdReset'].listen((e) {
e = convertToDart(e);
// Read things from `e`.
print("Got show Event!");
selected = 1;
});
}
所以,我捕获了该事件 - 我可以在控制台中看到它。但页面没有改变。
我仍然可以通过在 Shadow-dom 中添加选定内容来手动更改它。
有什么问题吗?
最佳答案
页面项目应该用 <neon-animatable>
包裹起来
像:
<neon-animatable><login-page></login-page></neon-animatable>
<neon-animatable><pwd-reset-page></pwd-reset-page></neon-animatable>
了解更多信息https://www.webcomponents.org/element/PolymerElements/neon-animation/neon-animatable
关于落 Dart polymer 结合性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41905626/