-
zhangwei
2025-03-24 2d43a1df3f5ba42710e6d21c27d1e13bdb8dfd56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<template>
    <!--本文件由FirstUI授权予四川政采招投标咨询有限公司(会员ID: 1 63,营业执照号: 9 1   5101   31332   0   0 6 19 3K)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
    <view class="fui-background__image-wrap"
        :style="{position:absolute?'absolute':'fixed',background:background,zIndex:zIndex}">
        <image :src="src" class="fui-background__image" :mode="aspectFill?'aspectFill':'scaleToFill'" v-if="src!=''">
        </image>
        <slot></slot>
    </view>
</template>
 
<script>
    export default {
        name: "fui-background-image",
        props: {
            src: {
                type: String,
                default: ''
            },
            background: {
                type: String,
                default: 'transparent'
            },
            zIndex: {
                type: [Number, String],
                default: -1
            },
            aspectFill: {
                type: Boolean,
                default: true
            },
            absolute: {
                type: Boolean,
                default: false
            }
        }
    }
</script>
 
<style>
    .fui-background__image-wrap {
        /* #ifndef APP-NVUE */
        width: 100%;
        height: 100%;
        /* #endif */
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
    }
 
    .fui-background__image {
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        /* #ifndef APP-NVUE */
        width: 100%;
        height: 100%;
        display: block;
        /* #endif */
    }
</style>