5
1

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 3 years have passed since last update.

Nuxt.jsで動的に画像のパスを指定する💪🐻

Last updated at Posted at 2020-07-07

#Nuxt.jsで画像のパスを指定したかった
requireを使って解決しました
(パスというより名前の指定な気もする…)

##失敗:よっしゃこれで…

 <img src="@/static/images/{{ $store.state.img }}" /> 

ダメだった🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺

##成功:じゃあこれで…

<img :src="require(`@/static/images/${$store.state.img}`)" />

ヤッターうまく表示できた💪💪💪💪💪💪💪💪🐻

5
1
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
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?