主题
myfooter.vue 自用悬浮底部组件
jsx
<template>
<view>
<view class="myfooter safe-area-inset-bottom" ref="myfooter" :style="{'z-index': zIndex}" :class="[className]">
<slot></slot>
</view>
<view class="footer-placeholder safe-area-inset-bottom">
<view :style="{'height': myfooterH + 'px'}"></view>
</view>
</view>
</template>
<script setup>
import {
ref,
computed,
} from "vue"
const props = defineProps({
zIndex: [String, Number],
className: String,
})
const myfooter = ref(null)
const myfooterH = computed(() => {
let h = myfooter.value?.$el.offsetHeight;
return h;
})
</script>
<style lang="scss" scoped>
.myfooter {
position: fixed;
bottom: 0;
left: 0;
z-index: 998;
width: 100%;
}
</style>
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
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