0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

nuxtでキャプション付き画像を横に並べる方法

Posted at

やりたいこと

動的にいくつ並ぶかわからない画像+キャプション(画像タイトルなど)をnuxtで表示したい

こんな感じに
Screen Shot 2022-11-18 at 13.50.09.png

結論

nuxt.js
<figure
  v-for="(file, index) in formData.files"
  :key="index"
  class="row-3 col-3 figure"
>
  <img
    class="rounded-1 w-100 mt-3"
    :src="images[index]"
    alt=""
    data-bs-target="#image-window-modal"
    data-bs-toggle="modal"
    @click="imageClick(index)"
  />
  <h6 data-dz-name="data-dz-name">
    {{ file.name }}
  </h6>
  <div class="d-flex align-items-center">
    <p
      class="mb-0 fs--1 text-400 lh-1"
      data-dz-size="data-dz-size"
    >
      {{ file.size.toLocaleString() }} Byte
    </p>
  </div>
  <div class="dropdown font-sans-serif">
    <button
      class="btn btn-link text-600 btn-sm dropdown-toggle btn-reveal dropdown-caret-none"
      type="button"
      data-bs-toggle="dropdown"
      aria-haspopup="true"
      aria-expanded="false"
    >
      <span class="fas fa-ellipsis-h"></span>
    </button>
    <div class="dropdown-menu border py-2">
      <a
        class="dropdown-item"
        href="#!"
        data-dz-remove="data-dz-remove"
        @click="onRemoveFile(file.name)"
      >Remove File</a>
    </div>
  </div>
</figure>


これでいけます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?