wppeng
wppeng
  • 发布:2020-01-07 11:13
  • 更新:2020-01-13 17:12
  • 阅读:138

【报Bug】nvue下map组件标记点没办法动态添加

分类:uni-app
<!-- 项目地图 -->  
<template>  
    <view class='map-page'>  
        <map :style="{width: windowWidth+'px', height: windowHeight+'px'}" scale="8" :latitude="latitude" :longitude="longitude"  
         :markers="covers">  
        </map>  
    </view>  
</template>  

<script>  
    import {  
        getPrjMap  
    } from '@/api/data.js';  
    import {  
        myUni  
    } from '@/common/uni.js';  
    import {  
        MyTime  
    } from '@/common/util.js';  
    export default {  
        data() {  
            return {  
                pageNo: 1,  
                pageSize: 10,  
                windowWidth: 375,  
                windowHeight: 667,  
                latitude: 39.909,  
                longitude: 116.39742,  
                covers: []  
            }  
        },  
        onLoad() {  

            let sysInfo = this.$store.state.systemInfo;  
            console.log(sysInfo);  
            this.windowWidth = sysInfo.windowWidth;  
            this.windowHeight = sysInfo.windowHeight;  
            this.bindData();  

        },  
        /**  
         * 计算属性  
         */  
        computed: {  

        },  
        methods: {  
            bindData() {  
                let that = this;  

                getPrjMap({  
                    UserCode: this.$store.state.userCode,  
                    PageNo: this.pageNo,  
                    PageSize: this.pageSize  
                }).then(data => {  
                    //console.log(JSON.stringify(data));  
                    that.latitude = 39.909;  
                    that.longitude = 116.39742;  
                    that.covers = [{  
                        "latitude": 39.909,  
                        "longitude": 116.39742,  
                        "iconPath": "/static/common/attendance/location_mark.png",  
                        "width": 35,  
                        "height": 35,  
                        "callout": {  
                            "content": "今天天气很好",  
                            "display": "BYCLICK",  
                            "bgColor": "#FFFFFF",  
                            "textAlign": "left",  
                            "padding": 10,  
                            "borderRadius": 10  
                        }  
                    }];  

                    //数据可以打印出来,没有标记点  
                    console.log(JSON.stringify(that.covers));  
                })  
            }  
        }  
    }  
</script>  

<style lang="scss" scoped>  
    .map-page {  
        height: 100%;  
    }  
</style>  
2020-01-07 11:13 分享
已邀请:
DCloud_UNI_HDX

DCloud_UNI_HDX

已经显示,是没有移动到地图中心

  • wppeng (作者)

    vue页面显示,是nvue页面不显示

    2020-01-07 17:24

  • wppeng (作者)

    版本2.5.1.20200103没有开启V3

    2020-01-07 17:25

  • DCloud_UNI_HDX

    回复 wppeng: 是用 nvue 验证的

    2020-01-07 17:37

  • DCloud_UNI_HDX

    回复 wppeng: V3 和 非V3 都是正常的

    2020-01-07 17:39

  • wppeng (作者)

    回复 DCloud_UNI_HDX: 好的,我在看看,谢谢

    2020-01-07 17:42

  • DCloud_UNI_HDX

    回复 wppeng: HBuilderX版本多少?

    2020-01-07 17:50

  • wppeng (作者)

    回复 DCloud_UNI_HDX: 出来了,有组数据报错了,现在编辑器数据报错有的都没有标红提示了吗, HBuilderX版本2.5.1.20200103

    2020-01-07 17:58

2336365486@qq.com

2336365486@qq.com

作者,怎么样了,现在解决了吗?

  • wppeng (作者)

    可以加载,只是感觉nvue有点慢和卡,我就用vue了

    2020-01-14 11:06

要回复问题请先登录注册