Polymer 聚合物布线不是布线
我正在尝试创建一个简单的应用程序。它有一个配置文件按钮,当按下配置文件按钮时,我希望它被路由到Userprofile页面。一般来说,我对聚合物和布线都很陌生,如果有人能告诉我我做错了什么,我将不胜感激。这是我的代码片段。我正在使用聚合物1.6,并使用应用程序路线,应用程序位置。我已经定义了它们,并且正在使用iron pages来选择路线(不确定这是否正确) cst tririga ux.htmlPolymer 聚合物布线不是布线,polymer,Polymer,我正在尝试创建一个简单的应用程序。它有一个配置文件按钮,当按下配置文件按钮时,我希望它被路由到Userprofile页面。一般来说,我对聚合物和布线都很陌生,如果有人能告诉我我做错了什么,我将不胜感激。这是我的代码片段。我正在使用聚合物1.6,并使用应用程序路线,应用程序位置。我已经定义了它们,并且正在使用iron pages来选择路线(不确定这是否正确) cst tririga ux.html <!-- POLYMER IMPORTS --> <link rel='impor
<!-- POLYMER IMPORTS -->
<link rel='import' href='../paper-icon-button/paper-icon-button.html'>
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../paper-badge/paper-badge.html">
<!-- APP TOOLBAR -->
<link rel="import" href='app-layout.html'>
<!-- IRON IMPORTS -->
<link rel="import" href="../iron-icons/iron-icons.html">
<link rel="import" href="../iron-pages/iron-pages.html">
<!-- TRIRIGA IMPORTS -->
<link rel="import" href="../triplat-view-behavior/triplat-view-behavior.html">
<link rel="import" href="../triplat-signout-button/triplat-signout-button.html">
<link rel="import" href="../triplat-ds/triplat-ds.html">
<!-- CUSTOM COMPONENTS -->
<link rel="import" href="profile/user-profile.html">
<link rel="import" href="notifications/notifications-view.html">
<dom-module id="cst-tririga-ux">
<template>
<style>
paper-input-container.my-class {
--paper-input-container-color: red;
--paper-input-container-focus-color: blue;
--paper-input-container-invalid-color: green;
--paper-input-container-input-color: black;
}
paper-badge {
--paper-badge-margin-left: -8px;
--paper-badge-margin-bottom: -12px;
--paper-badge-background: #D50000;
};
html, body {
margin: 0;
font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased;
background: #f1f1f1;
max-height: 368px;
}
paper-icon-button {
--paper-icon-button-ink-color: white;
}
paper-icon-button + [main-title] {
margin-left: 24px;
}
app-header {
@apply(--layout-fixed-top);
color: #fff;
--app-header-background-rear-layer: {
background-color: #ef6c00;
};
}
app-drawer {
--app-drawer-scrim-background: rgba(0, 0, 100, 0.8);
--app-drawer-content-container: {
background-color: #f4f6f7;
}
}
app-toolbar {
/* Toolbar is the main header, so give it some color */
background-color: #1E88E5;
font-family: 'Roboto', Helvetica, sans-serif;
color: white;
--app-toolbar-font-size: 24px;
}
</style>
<!-- DECLARATIONS -->
<triplat-ds id="currentDS" name="currentUser" data="{{currentUser}}"></triplat-ds>
<triplat-ds id="myNotificationsDS" name="myNotifications" data="{{myNotifications}}"></triplat-ds>
<app-location use-hash-as-path route="{{route}}"></app-location>
<app-route route="{{route}}" pattern="/:view" data="{{routeData}}" tail="{{subroute}}"></app-route>
<body>
<app-header reveals>
<app-toolbar>
<paper-icon-button icon="menu" onclick="drawer.toggle()"></paper-icon-button>
<div main-title>Spork</div>
<paper-icon-button icon="account-circle" id="profile" on-tap="redirectToProfile"></paper-icon-button>
<paper-icon-button icon="mail" id="notifications"></paper-icon-button>
<paper-badge for="notifications" label="{{myNotifications.length}}"></paper-badge>
<triplat-signout-button></triplat-signout-button>
</app-toolbar>
<iron-pages selected="[[routeData.view]]" attr-for-selected="name">
<user-profile name="profile" route="{{subroute}}"></user-profile>
<notifications-view name="notifications" route="{{subroute}}"></notifications-view>
</iron-pages>
</app-header>
<app-drawer id="drawer" swipe-open>
<paper-menu selected="0">
<paper-item>Item One</paper-item>
<paper-item>Item Two</paper-item>
<paper-item>Item Three</paper-item>
</paper-menu>
</app-drawer>
</body>
</template>
<dom-module>
<script>
Polymer({
is: "cst-tririga-ux",
behaviors: [TriPlatViewBehavior],
// Display in browser title.
ready: function() {
var __dictionary__title = "Prudential CRE";
document.title = __dictionary__title;
},
redirectToProfile : function(el) {
var currUser = this.currentUser;
location.pathname = "/#/profile"
}
});
</script>
纸张输入容器.my-class{
--纸张输入容器颜色:红色;
--纸张输入容器焦点颜色:蓝色;
--纸张输入容器无效颜色:绿色;
--纸张输入容器输入颜色:黑色;
}
纸徽章{
--纸徽章左边距:-8px;
--纸徽章页边距底部:-12px;
--纸质徽章背景:#D50000;
};
html,正文{
保证金:0;
字体系列:“Roboto”,“Noto”,无衬线;
-webkit字体平滑:抗锯齿;
背景#f1f1;
最大高度:368px;
}
纸张图标按钮{
--纸张图标按钮墨水颜色:白色;
}
纸张图标按钮+[主标题]{
左边距:24px;
}
应用程序标题{
@应用(--布局固定顶部);
颜色:#fff;
--应用程序标题背景后层:{
背景色:#ef6c00;
};
}
应用程序抽屉{
--应用程序抽屉纸条背景:rgba(0,0,100,0.8);
--应用程序抽屉内容容器:{
背景色:#f4f6f7;
}
}
应用程序工具栏{
/*工具栏是主标题,所以给它一些颜色*/
背景色:#1E88E5;
字体系列:“Roboto”,Helvetica,无衬线;
颜色:白色;
--应用程序工具栏字体大小:24px;
}
斯波克
项目一
项目二
项目三
聚合物({
是:“cst tririga ux”,
行为:[TriPlatViewBehavior],
//以浏览器标题显示。
就绪:函数(){
var\uuuu dictionary\uuuuu title=“保诚信贷”;
document.title=\uuuuu字典\uuuuu标题;
},
重定向到配置文件:函数(el){
var currUser=this.currentUser;
location.pathname=“/#/profile”
}
});
用户配置文件和通知视图只是模板。当前,当我单击“我的个人资料”按钮时。似乎什么也没发生。不知道我做错了什么。这是我的user-profile.html
<dom-module id="user-profile">
<template>
<div>My user page</div>
</template>
</dom-module>
<script>
Polymer({
is: "user-profile",
});
</script>
我的用户页面
聚合物({
是:“用户配置文件”,
});
尝试为应用程序位置
,应用程序路径
添加导入,并关闭主文件中的dom模块
标记。您对应用程序路线
和铁页
使用了正确的方法谢谢您的回复,不幸的是它没有起作用。我有app-layout.html,其中包含所有导入内容。我确实关闭了dom模块。不知道发生了什么事。