好吧,我能够正确显示图像,但它仍然无缘无故地在控制台中给我javascript错误。这是我的代码:
获取类别:
fetchCategory: function(){
this.$http.get('get_category').then(function(response){
this.$set('categories',response.json());
});
}
这是显示类别的表格:
<table class="table table-bordered table-responsive table-striped example1">
<thead>
<tr>
<th>ID</th>
<th>Category Name</th>
<th>Icon</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr v-for="category in categories">
<td>@{{ category.id }}</td>
<td>@{{ category.name }}</td>
<td><img src="{{url('/')}}/@{{ category.icon }}" width="150px"></td>
<td>Edit | Delete</td>
</tr>
</tbody>
</table>
它正确显示图像,但javascript控制台仍然显示2 404错误,指示图像的网址GET http://localhost/project/%7B%7B%20category.icon%20%7D%7D 404(未找到)
我应该忽略这个错误吗?或者是否有任何其他方法在图像路径中包含基本网址?