无风来了
无风来了
  • 发布:2019-10-08 18:02
  • 更新:2022-06-15 15:36
  • 阅读:3531

【报Bug】uni-app map组件 polyline 报错 Uncaught Error: Invalid value or type for property <strokeColor>

分类:uni-app

详细问题描述

[步骤]
uni-APP 静态内容

<template>  
    <view class="content">  
        <map class="map" :latitude="latitude" :longitude="longitude" :markers="covers" :style="{height: height+'px'}" :polyline="polyline"></map>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  
                id: 0,  
                model:{},  
                latitude: 39.909,  
                longitude: 116.39742,  
                height:500,  
                polyline: [{  
                    points:[  
                        {latitude: 39.909,longitude: 116.39742},  
                        {latitude: 39.909,longitude: 116.29742}  
                    ],  
                    color:"#0000AA",//线的颜色  
                    width:20,//线的宽度  
                    dottedLine:true,//是否虚线  
                    arrowLine: true,    //带箭头的线 开发者工具暂不支持该属性  
                }],  
                covers: [{  
                    latitude: 39.909,//纬度  
                    longitude: 116.39742,//经度  
                    iconPath: '../../static/icon_address_orange.png',   //显示的图标           
                    title:'阿打算',//标注点名  
                    label:{//为标记点旁边增加标签  
                        content:'文本1',//文本  
                        color:'#F76350',//文本颜色  
                        anchorX:0,//label的坐标,原点是 marker 对应的经纬度  
                        anchorY:-80,//label的坐标,原点是 marker 对应的经纬度   
//                      x:39.909,//这个组件微信在1.2.0以后就废弃了  
//                      y:116.39742,  
                        bgColor:'#fff',//背景色  
                        padding:5,//文本边缘留白  
                        borderWidth:1,//边框宽度  
                        borderColor:'#D84C29',//边框颜色                              
                        textAlign:'right'//文本对齐方式。  
                     },  
                     callout:{//自定义标记点上方的气泡窗口 点击有效  
                        content:'地点1',  
                        color:'#F76350',  
                        fontSize:12,  
                        borderRadius:5,  
                     },  
//                   anchor:{//经纬度在标注图标的锚点,默认底边中点  
//                       x:5,  
//                       y:1,  
//                    }  
                }, {  
                    latitude: 39.90,  
                    longitude: 116.39,  
                    iconPath: '../../static/image/personal_center.png',  
                    title:'阿迪达斯',  
                    x:39.90,  
                    y:116.399,  
                    label:{  
                        content:'文本2',  
                        color:'#F76350',  
                        bgColor:'#fff',  
                        padding:5,  
                        borderRadius:4,  
                     },  
                     callout:{  
                            content:'地点2',  
                            color:'#F76350',  
                            fontSize:12  
                     }  
                }],  
            }  
        },  
        onLoad:function(o){  

        },  
        methods:{  

        }  

    }  
</script>  

<style>  
    .map{width: 750upx;}  
</style>

[结果]

出现报错
Uncaught Error: Invalid value or type for property <strokeColor> :undefined

2019-10-08 18:02 负责人:无 分享
已邀请:
无风来了

无风来了 (作者)

重启电脑后,组件可以用了

  • 2***@qq.com

    重启电脑,不行,还是错误

    2021-09-14 11:26

tang999

tang999

楼主解决了吗,我也是报这个错

  • 冬至D

    复制到微信小程序可以直接用没有报错.....

    2022-06-15 15:36

3***@qq.com

3***@qq.com

设置borderColor属性,源码里是用borderColor属性填充的strokeColor,这个太误导人了。要么这里文档有错误,borderColor属性必填项应该为“是”。

冬至D

冬至D

不得不说你写的真好,微信小程序复制过来直接用并无bug

该问题目前已经被锁定, 无法添加新回复