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