The background image set by background-image in uniapp does not display the problem

has a problem

<view class="file-picker__box jsz" @tap="jszxszUpload('jsz')"></view>
.jsz {
    
    
  background-image: url('../../static/example_drive.png');
}

Insert image description here

Solve 1

<view class="file-picker__box jsz" :style="{ 'background-image': 'url('+example_drive+')' }" @tap="jszxszUpload('jsz')"></view>
data(){
    
    
  return {
    
    
    example_drive: '../../static/example_drive.png'
  }
}

Solution 2

<view class="file-picker__box jsz" @tap="jszxszUpload('jsz')"></view>
.jsz {
    
    
  background-image: url('使用base64格式');
}

Guess you like

Origin blog.csdn.net/m0_53562074/article/details/134014525