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