Home >Web Front-end >uni-app >What should I do if the background image set by uniapp cannot be displayed?
Solution to the problem that the background image set by uniapp cannot be displayed: 1. Check the image size, and then convert it to base64 format for use or put it on the server and reference it from the network address; 2. Change the local background image Modify the reference path to an absolute path starting with the "~@" symbol.
The operating environment of this tutorial: windows7 system, uni-app2.5.1 version, Dell G3 computer.
Recommendation (free): uni-app tutorial
The background image of uni-app is not displayed on the mobile phone?
<template> <view class="index" :style="{backgroundImage:`url(${indexBackgroundImage})`,backgroundSize: 'cover'}"> <!--你的内容--> </view> </template> <script> import indexBackgroundImage from "@/static/img/account_index.jpg" export default { data() { return { indexBackgroundImage:indexBackgroundImage } }, methods: { } } </script> <style lang="scss" scoped=""> </style>
The above is the detailed content of What should I do if the background image set by uniapp cannot be displayed?. For more information, please follow other related articles on the PHP Chinese website!