웹 사이트 재 설계에 Polymer을 사용했습니다. 요소에 바인딩 된 이미지를 background-image
으로 표시하고 싶습니다. 상당히 간단한 작업이지만 불행히도 몇 가지 문제가 있습니다.데이터 바인딩이있는 폴리머 이미지
간편한 테스트를 위해 실행중인 코드 샘플을 만들었습니다 : click me.
<polymer-element name="album-card" attributes="image">
<template>
<style>
:host{
display: block;
position: relative;
background-color: #99182c;
width: 200px;
}
.description{
padding: 10px;
color: white;
}
.circular{
width: 200px;
height: 200px;
background: url({{image}}) no-repeat;
background-color:green;
}
</style><link rel="stylesheet" href="default_styles.css">
<paper-shadow z="{{shadowValue}}" animated="true"></paper-shadow>
<div class="album-header" vertical layout>
<paper-ripple class="recenteringTouch" fit></paper-ripple>
<div class="circular">
<!--<img src="{{image}}" />--><!-- this does work -->
</div>
<div class="description">
<content select="h2"></content>
<content select="h4"></content>
</div>
</div>
</template>
<script>
Polymer('album-card');
</script>
</polymer-element>
문제는 CSS 스타일링에 있습니다. 어떤 이유로 이미지가 다음 줄에 표시되지 않습니다 : background: url({{image}}) no-repeat;
. 다른 곳합니다 (<div class="circular">
의 몸에 {{image}}
를 사용하는 경우, 이미지는 않습니다 표시됩니다.
{{image}}
교체
.
내가 잘못을하고있는 중이 야 무엇?
이러한 문제를 인식하지 못했습니다. 포괄적 인 답변 주셔서 감사합니다! – jdepypere