WeChat Mini Programs sets the background image for the label element, and the address is taken from the data data. Why can't you find the picture when you report an error?


<view wx:for="{{name_tel}}">
    <label for="{{item.id}}" style="background-image:url({{item.imgUrl}})"></label>
    <input id="{{item.id}}" type="text" placeholder="{{item.placeholder}}"></input>
  </view>

the background image address of label cannot be found here. An error was reported as:

Failed to load local image resource / pages/index/images/smapp_name.png

the server responded with a status of 404 (HTTP/1.1 404 Not Found)
console view label structure:


<labelclass="label-img"for="peopleName"style="background-image:url(images/smapp_name.png)"></label>

has solved the problem of the picture address. Just add.. /. / to the picture address.

Menu