support width/height img attributes
This commit is contained in:
parent
9a6363431d
commit
a9830ff491
@ -5,7 +5,9 @@ const StillImage = {
|
|||||||
'mimetype',
|
'mimetype',
|
||||||
'imageLoadError',
|
'imageLoadError',
|
||||||
'imageLoadHandler',
|
'imageLoadHandler',
|
||||||
'alt'
|
'alt',
|
||||||
|
'height',
|
||||||
|
'width'
|
||||||
],
|
],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@ -15,6 +17,13 @@ const StillImage = {
|
|||||||
computed: {
|
computed: {
|
||||||
animated () {
|
animated () {
|
||||||
return this.stopGifs && (this.mimetype === 'image/gif' || this.src.endsWith('.gif'))
|
return this.stopGifs && (this.mimetype === 'image/gif' || this.src.endsWith('.gif'))
|
||||||
|
},
|
||||||
|
style () {
|
||||||
|
const appendPx = (str) => /\d$/.test(str) ? str + 'px' : str
|
||||||
|
return {
|
||||||
|
height: this.height ? appendPx(this.height) : null,
|
||||||
|
width: this.width ? appendPx(this.width) : null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<div
|
<div
|
||||||
class="still-image"
|
class="still-image"
|
||||||
:class="{ animated: animated }"
|
:class="{ animated: animated }"
|
||||||
|
:style="style"
|
||||||
>
|
>
|
||||||
<canvas
|
<canvas
|
||||||
v-if="animated"
|
v-if="animated"
|
||||||
|
Loading…
Reference in New Issue
Block a user