Commit 6b213ceaca06aa5a1407fa6b9e9ec569f193b84d
1 parent
7aa92591
update work cover style
Showing
2 changed files
with
16 additions
and
6 deletions
front-end/h5/src/components/common/work/card-cover.js
| 1 | 1 | export default { |
| 2 | 2 | props: { |
| 3 | - qrCode: String, | |
| 3 | + qrcodeUrl: String, | |
| 4 | 4 | coverImageUrl: String |
| 5 | 5 | }, |
| 6 | 6 | render (h) { |
| 7 | - if (this.qrcode) { | |
| 8 | - return <img src={this.qrcodeUrl} /> | |
| 9 | - } | |
| 10 | - if (this.coverImageUrl) { | |
| 11 | - return <img src={this.coverImageUrl} style="width:100%;height: 100%;" /> | |
| 7 | + const img = this.qrcodeUrl || this.coverImageUrl | |
| 8 | + if (img) { | |
| 9 | + const style = { | |
| 10 | + 'background-image': `url(${img})`, | |
| 11 | + 'background-size': this.qrcodeUrl ? 'contain' : 'cover' | |
| 12 | + } | |
| 13 | + return <div style={style} class="work-cover-img"></div> | |
| 12 | 14 | } |
| 13 | 15 | |
| 14 | 16 | return <span>Luban H5</span> | ... | ... |
front-end/h5/src/components/core/styles/index.scss