uni-app 设置背景图片

uni-app About 392 words

方法一:加载网络图片

<view style="min-height: 100vh;background-image: url(https://xxx.com/aaa.jpeg);">
</view>

方法二:image 元素

<template>
    <view>
        <image class="bg-img" mode="scaleToFill" src="/static/bg.jpg"></image>
        <view>其他元素</view>
    </view>
</template>

<style>
    .bg-img {
        width: 100%;
        height: 100%;
        position: fixed;
        z-index: -1;
    }
</style>
Views: 58 · Posted: 2025-08-01

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh