以下のようにコードを書いて、配列内にある画像があるpathに、 v-lazy="require(path)"
で表示したいです
<template> <div id="imglist"> {{ items }} <ul> <li v-for="item in items"> {{ item }} <img v-lazy="loadImg(item)"> </li> </ul> </div> </template> <script> import axios from 'axios' export default { name: 'ImgList', data() { items: [ '/public/images/logo.png', '/public/images/logo2.png' ] }, methods: { loadImg: function (path) { require(path) } } } </script>
エラー内容は、 vue-cli
を使用して、npm run dev
で起動していて以下のようにエラーが表示されます。
warning in ./src/components/ImgList.vue Critical dependency: the request of a dependency is an expression
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。