結論
<template>
<div>
<img :src="'/img/image.jpg'">
</div>
</template>
解説
1. Vue.jsから見た/
ルートは/public
appName/public/img/image.jpg
にあるファイルは
/img/image.jpg
で呼び出せます。
補足: /public
はlaravelで作製したディレクトリで/app
や/routes
と同じ階層のことだよ!
これはコンパイルするディレクトリが指定されているからだね!
Laravelなら多分laravel-mix使ってるかな?
webpack.mix.js
ってファイルに個別設定とrequire()
で呼び出されてるものがあるから追ってみるといい!
2. :src=""
の形式でpathを文字列で指定する
src='/img/image.jpg'
で書くとコンパイルすらさせて貰えなかったりするよ!
だから:src=""
のVue.jsの書き方で書いてあげないとうまく認識できないんだ!
さらに:src="'文字列'"
としてダブルクオートの中にシングルクオートを書いて文字列として
渡して上げないと「そんな変数ねぇーじゃんwww」と怒られちゃう。