Add source set for different sizes to uploadcare images
This commit is contained in:
parent
74820f52b6
commit
f3f00f472f
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<img
|
||||
:src="value.url"
|
||||
alt=""
|
||||
:srcset="srcset"
|
||||
class="image-block"
|
||||
@click="openFullscreen"
|
||||
/>
|
||||
|
|
@ -10,6 +10,19 @@
|
|||
<script>
|
||||
export default {
|
||||
props: ['value'],
|
||||
computed: {
|
||||
srcset() {
|
||||
if (this.value.url.includes('ucarecdn')) {
|
||||
return (
|
||||
this.value.url +
|
||||
'-/resize/300/ 300w,' +
|
||||
this.value.url +
|
||||
'-/resize/800/ 800w,'
|
||||
);
|
||||
}
|
||||
return '';
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
openFullscreen() {
|
||||
this.$store.dispatch('showFullscreenImage', this.value.url);
|
||||
|
|
|
|||
Loading…
Reference in New Issue