更改Polymer应用程序标题上的CSS变量背景图像
我想使用CSS变量动态更新背景图像更改Polymer应用程序标题上的CSS变量背景图像,css,polymer-1.0,web-component,Css,Polymer 1.0,Web Component,我想使用CSS变量动态更新背景图像 app-header { background-color: var(--paper-red-500); --app-header-background-front-layer: { background-image: url(var(--profile-cover)); }; } 但它不会使用这种方法进行更新: this.customStyle['--profile-cover'] = url; this.updat
app-header {
background-color: var(--paper-red-500);
--app-header-background-front-layer: {
background-image: url(var(--profile-cover));
};
}
但它不会使用这种方法进行更新:
this.customStyle['--profile-cover'] = url;
this.updateStyles();
app头元件由聚合物制成:)
有答案吗?我知道了
this.customStyle['--profile-cover'] = 'url(\'' + url + '\')'
因此,基本上我必须更改CSS:
background-image: var(--profile-cover);