From 93c26a523ef5864af38428eaeecc481bea913d2f Mon Sep 17 00:00:00 2001 From: Trirst <abeces968@gmail.com> Date: Tue, 7 Sep 2021 02:14:48 +0700 Subject: [PATCH] Image's tags are now displayed on the image's page --- src/views/ImageView.vue | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/views/ImageView.vue b/src/views/ImageView.vue index f965020..71b2ec1 100644 --- a/src/views/ImageView.vue +++ b/src/views/ImageView.vue @@ -1,5 +1,13 @@ <template> - <div> + <div class="flex flex-row"> + <section class="flex flex-col sticky top-0 h-screen w-1/3"> + <div> + Tags: + <span v-for="imageTag in imageTags"> + {{ imageTag }} + </span> + </div> + </section> <div id="image-container"> <img :src="`/api/image/${flake}/file`" alt="" /> </div> @@ -8,11 +16,26 @@ <script> export default { + data: function () { + return { + imageTags: Array, + }; + }, computed: { flake: () => { return window.location.pathname.split("/").pop(); }, }, + methods: { + async getImageTags() { + const response = await fetch(`/api/image/${this.flake}/tag`); + const imageTags = await response.json(); + return imageTags; + }, + }, + async created() { + this.imageTags = await this.getImageTags(); + }, }; </script> -- GitLab