aboutsummaryrefslogtreecommitdiff
path: root/src/components/still-image
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/still-image')
-rw-r--r--src/components/still-image/still-image.js6
-rw-r--r--src/components/still-image/still-image.vue20
2 files changed, 21 insertions, 5 deletions
diff --git a/src/components/still-image/still-image.js b/src/components/still-image/still-image.js
index 02e98f19..e48fef47 100644
--- a/src/components/still-image/still-image.js
+++ b/src/components/still-image/still-image.js
@@ -3,11 +3,12 @@ const StillImage = {
'src',
'referrerpolicy',
'mimetype',
- 'imageLoadError'
+ 'imageLoadError',
+ 'imageLoadHandler'
],
data () {
return {
- stopGifs: this.$store.state.config.stopGifs
+ stopGifs: this.$store.getters.mergedConfig.stopGifs
}
},
computed: {
@@ -17,6 +18,7 @@ const StillImage = {
},
methods: {
onLoad () {
+ this.imageLoadHandler && this.imageLoadHandler(this.$refs.src)
const canvas = this.$refs.canvas
if (!canvas) return
const width = this.$refs.src.naturalWidth
diff --git a/src/components/still-image/still-image.vue b/src/components/still-image/still-image.vue
index af824fa2..4137bd59 100644
--- a/src/components/still-image/still-image.vue
+++ b/src/components/still-image/still-image.vue
@@ -1,7 +1,21 @@
<template>
- <div class='still-image' :class='{ animated: animated }' >
- <canvas ref="canvas" v-if="animated"></canvas>
- <img ref="src" :src="src" :referrerpolicy="referrerpolicy" v-on:load="onLoad" @error="onError"/>
+ <div
+ class="still-image"
+ :class="{ animated: animated }"
+ >
+ <canvas
+ v-if="animated"
+ ref="canvas"
+ />
+ <!-- NOTE: key is required to force to re-render img tag when src is changed -->
+ <img
+ ref="src"
+ :key="src"
+ :src="src"
+ :referrerpolicy="referrerpolicy"
+ @load="onLoad"
+ @error="onError"
+ >
</div>
</template>