给定这样的绑定
<img data-bind="attr: { src: (adv.packageImagesVm.imageUrlBase() + $data) }" alt="product image" />
图像确实可以正确显示,但我可以在网络请求中看到两个请求被触发:
1:(myAccount.blob.core.windows.net/public/myImage.png
好的)
和(莫名其妙地)
2.http://localhost/public/myImage.png
有谁知道为什么会发生第二个请求?
编辑:更多的代码:
<ul class="thumbnails" data-bind="foreach: packageImagesCollectionDto().PackageVoucherImageUrls">
<li class="span2" data-bind="if: $data, visible: $data">
<img data-bind="attr: { src: (adv.packageImagesVm.imageUrlBase() + $data) }" alt="product image" />
</li>
</ul>
编辑:这是结果<div data-bind="text: ko.toJSON($data)"></div>
{
"packageImagesCollectionDto": {
"PackageId": 2,
"PackageImageUrls": [
"/public/product/55/AAID220.jpg",
"/public/product/80/retreat.jpg"
],
"PackageVoucherImageUrls": [
"/public/product/55/voucher/AAFL2xx.jpg",
"/public/product/80/voucher/ddVoucher.jpg"
]
},
"imageUrlBase": "http://xyz.blob.core.windows.net"
}