show images after upload

This commit is contained in:
isUnknown 2024-09-27 16:35:08 +02:00
parent 6d43e3b8c7
commit 0a92835c30
3 changed files with 20 additions and 45 deletions

View file

@ -68,48 +68,10 @@
</button>
<Toast />
</div>
<!-- <figure class="image">
<figure v-for="image in images" class="image">
<span class="tag | btn btn--sm">Tag</span>
<img
src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/6ed93d6950-1725442486/d82f18573c439d6edd434ffca62471a7.png"
alt=""
/>
<img :src="image" alt="" />
</figure>
<figure class="image">
<span class="tag | btn btn--sm">Tag</span>
<img
src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/7b0fcc5012-1725442486/37a038883c87973036232aa0e43f6da2.png"
alt=""
/>
</figure>
<figure class="image">
<span class="tag | btn btn--sm">Tag</span>
<img
src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/1bbe051c5a-1725442486/0c41d3266e9ce2872f30608cceb28239.png"
alt=""
/>
</figure>
<figure class="image">
<span class="tag | btn btn--sm">Tag</span>
<img
src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/6ed93d6950-1725442486/d82f18573c439d6edd434ffca62471a7.png"
alt=""
/>
</figure>
<figure class="image">
<span class="tag | btn btn--sm">Tag</span>
<img
src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/7b0fcc5012-1725442486/37a038883c87973036232aa0e43f6da2.png"
alt=""
/>
</figure>
<figure class="image">
<span class="tag | btn btn--sm">Tag</span>
<img
src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/1bbe051c5a-1725442486/0c41d3266e9ce2872f30608cceb28239.png"
alt=""
/>
</figure> -->
</section>
</template>
@ -118,6 +80,7 @@ import Toast from "primevue/toast";
import FileUpload from "primevue/fileupload";
import { useToast } from "primevue/usetoast";
import { usePageStore } from "../../../stores/page";
import { ref } from "vue";
const { page } = usePageStore();
const toast = useToast();
@ -130,6 +93,8 @@ const beforeSend = (event) => {
);
};
const images = ref([]);
const onAdvancedUpload = (event) => {
if (event.xhr.status === 200) {
toast.add({
@ -138,7 +103,9 @@ const onAdvancedUpload = (event) => {
detail: event.xhr.response.success,
life: 3000,
});
console.log(JSON.parse(event.xhr.response));
const response = JSON.parse(event.xhr.response);
console.log(response);
images.value = response.images;
} else {
toast.add({
severity: "error",