具有图像路径问题的包裹

问题描述 投票:0回答:1

我正在从json文件中接收数据,其中每个对象都具有以下有关表演/音乐的数据:

{
    "Theatre": [
       {
            "name": "Hairspray",
            "type": "Musical",
            "role": "Dynamite",
            "director": "Sue Ellen Nielson",
            "company": "Stage 1 / East Bay Area",
            "year": "2012",
            "posterImage" : "hairsprayPoster.jpg"
        }  .....
]

}

on the Vue file I have : 

<ul class="show-gallery-list">
                   <li v-for="dataItem in myJson['Theatre']" >

                     {{dataItem.coverImage}} //this prints the path as a string
                     <img :src="dataItem.coverImage"> //this renders an empty image icon 

                </li> 
            </ul>

所有其他数据都可以访问并呈现。我已经尝试了v-bind:src的一切我曾尝试导入图像文件夹,但这也不起作用。

包裹将不允许我动态渲染图像吗?我是否必须导入所有图像?这是捆绑问题吗?

image vue.js bundler parcel
1个回答
0
投票

实际上这并不是直接使用parcelJS进行的整个GitHub issue对话,讨论了可能的替代方法

乍看之下最有希望的是this plugin

© www.soinside.com 2019 - 2024. All rights reserved.