The local image in uniapp is not displayed, the background image attribute

method one:

<image  :src="require('static/login/user.png')" class="userImg"></image>

Method Two:

Note: The same image is located under static/login in the root directory, but when used as a background image, you need to add ../.../ if an error is reported according to the above writing rules

It is recommended to use the background image for local images. The network can use src

.iptPasswd {
	background: url(../../static/login/user.png) no-repeat 20rpx  center ;
	background-size: 45rpx;
 }

If you don't write a 20rpx icon, it will be centered in the form

20rpx is the distance from the background image to the left border of the form

Writing in the 20rpx center position has no effect!

Guess you like

Origin blog.csdn.net/weixin_57607714/article/details/124123841