uniapp nvue页面 map地图全屏设置

因为

nvue页面:100vh 以及百分比不可用,

所以

1,可以获取当前屏幕高度 然后赋值

<map :latitude="latitude" :longitude="longitude" :style="'height:'+windowHeight*2+'rpx;'"></map>
const { windowWidth, windowHeight,appName } = uni.getSystemInfoSync();    

 完整代码:

<template>
    <view>
        <map style="width: 750rpx;" :style="'height:'+windowHeight*2+'rpx;'" 
            :latitude="data_info.latitude"
            :longitude="data_info.longitude" 
            >
        </map>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                windowHeight : uni.getSystemInfoSync().windowHeight,//屏幕高度
                data_info:{
                    'latitude':'34.259428',
                    'longitude':'108.947040',
                    'scale':17,//缩放级别(类型为Number,默认值为16,缩放级别取值范围为5-18)
                },
            }
        },
        methods: {
            
        }
    }
</script>

<style>

</style>

 

posted @ 2024-02-26 16:05  zhang_you_wu  阅读(250)  评论(0编辑  收藏  举报