1. util.js中定义方法
function pointInsideCircle(point, circle, r) {
if (r === 0) return false
var dx = circle[0] - point[0]
var dy = circle[1] - point[1]
return dx * dx + dy * dy <= r * r;
}
2. util.js中暴露改方法
module.exports = {
pointInsideCircle
}
3. A.vue页面中引用
import {pointInsideCircle} from "@/common/util.js"
4. A.vue页面中使用
var s = pointInsideCircle([that.latitude,that.longitude],[that.circles[0].latitude,that.circles[0].longitude],that.r/100000);