zhaojs
2023-09-15 fc13938ff90213060532d99a600dea4a84456885
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
<template>
    <view class="position-absolute" :style="{zIndex: 99,height: height + 'px', top: top + 'px', left: left + 'px'}" @tap="click">
        <image src="/static/images/back.png" :style="{height: height + 'px', width: height + 'px'}"></image>
    </view>
</template>
 
<script>
    export default {
        name: "navbarBackButton",
        data() {
            return {
                height: 0,
                left: 0,
                top: 0
            }
        },
        created() {
            //#ifdef MP-WEIXIN
            const {height, right, top} = uni.getMenuButtonBoundingClientRect()
            const {windowWidth} = uni.getSystemInfoSync()
            this.top = top
            this.left = windowWidth - right
            this.height = height
            //#endif
            //#ifndef MP-WEIXIN
            this.height = 32
            this.top = 26
            this.left = 10
            //#endif
 
        },
        methods: {
            click() {
                uni.navigateBack()
            }
        }
    }
</script>
 
<style lang="scss" scoped>
</style>