动态更改app标题的backgorund图像(Polymer)

时间:2017-02-14 03:41:10

标签: javascript polymer polymer-1.0 web-component

app标题样式如下所示

app-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 212px;
  color: #fff;
  background-color: #3f51b5;
  --app-header-background-front-layer: {
    background-image: url(//app-layout-assets.appspot.com/assets/bg1.jpg);
    background-position: left center;
  };
}




<app-header condenses reveals effects="waterfall resize-title blend-background parallax-background">
  <app-toolbar>
  <paper-icon-button icon="menu"></paper-icon-button>
     <h4 condensed-title>What is material? &mdash; Environment</h4>
  <paper-icon-button icon="search"></paper-icon-button>
</app-toolbar>
<app-toolbar class="tall">
    <h1 main-title>What is material?</h1>
</app-toolbar>

如何动态更改背景图片网址并在javascript中将其与我自己的网址交换?

1 个答案:

答案 0 :(得分:0)

HREF $ = “{{imgUrl的}}”

使用计算属性或观察者更改图像。

保重