Javascript 在传单上加上圆圈表示';x';未定义的
我使用的是传单vuejs,导入的圆圈与javascript代码相同,下面是我使用的传单网站的示例代码:Javascript 在传单上加上圆圈表示';x';未定义的,javascript,leaflet,Javascript,Leaflet,我使用的是传单vuejs,导入的圆圈与javascript代码相同,下面是我使用的传单网站的示例代码: var circle = L.circle([51.508, -0.11], { color: 'red', fillColor: '#f03', fillOpacity: 0.5, radius: 50
var circle = L.circle([51.508, -0.11], {
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5,
radius: 500
}).addTo(this.$refs.map.mapObject);
因此,当我运行上述代码时,会出现错误:
未捕获(承诺中)TypeError:无法读取未定义的属性“x”
如果我画的多边形效果很好,没问题
在控制台代码中,它还指向以下行:
// @method intersects(otherBounds: Bounds): Boolean
// Returns `true` if the rectangle intersects the given bounds. Two bounds
// intersect if they have at least one point in common.
intersects: function (bounds) { // (Bounds) -> Boolean
bounds = toBounds(bounds);
var min = this.min,
max = this.max,
min2 = bounds.min,
max2 = bounds.max,
xIntersects = (max2.x >= min.x) && (min2.x <= max.x),
yIntersects = (max2.y >= min.y) && (min2.y <= max.y);
return xIntersects && yIntersects;
}
/@方法相交(其他边界:边界):布尔值
//如果矩形与给定边界相交,则返回'true'。两个界限
//如果它们至少有一个公共点,则相交。
相交:函数(边界){/(边界)->布尔
边界=toBounds(边界);
var min=this.min,
max=this.max,
min2=bounds.min,
max2=bounds.max,
xIntersects=(max2.x>=min.x)&&(min2.x=min.y)&&(min2.y)&&(min2.y)您确定这个$refs.map.mapObject
实际上是一个地图对象吗?您使用的是什么版本的传单?传单@^1.3.4,是的对象与其他东西一样,如瓷砖和多边形。