2018-01-29 18:47:26 +11:00
|
|
|
const StillImage = {
|
|
|
|
props: [
|
|
|
|
'src',
|
|
|
|
'referrerpolicy',
|
|
|
|
'mimetype'
|
|
|
|
],
|
|
|
|
computed: {
|
2018-02-04 04:32:13 +11:00
|
|
|
animated () {
|
|
|
|
return this.mimetype === 'image/gif' || this.src.endsWith('.gif')
|
2018-01-29 18:47:26 +11:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2018-02-04 03:55:45 +11:00
|
|
|
onLoad () {
|
2018-01-29 18:47:26 +11:00
|
|
|
const canvas = this.$refs.canvas
|
|
|
|
if (!canvas) return
|
2018-02-04 03:55:45 +11:00
|
|
|
canvas.getContext('2d').drawImage(this.$refs.src, 1, 1, canvas.width, canvas.height)
|
2018-01-29 18:47:26 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default StillImage
|