# location-judge

![](https://img.shields.io/npm/v/@ubrorg/location-judge.svg?style=flat) ![](https://img.shields.io/npm/dt/@ubrorg/location-judge.svg?style=flat)

> 位置判断

## 使用

静默获取用户当前位置调用getLocation()
页面导航按钮点击时调用judgeLocation()

```js
import { judgeLocation, getLocation } from "@ubrorg/location-judge";

// 页面导航点击事件
async handelNavigation() {
  // 在当前页面编译模式入参 flag: true 可跳过位置校验，方便测试；默认为false，可不传
  const isInThePark = await judgeLocation({ flag: false })
  console.log(isInThePark)
}

// 静默获取当前位置
async handleGetLocation() {
  const myLocation = await getLocation()
  console.log(myLocation)
}
```


## 开发

1. `yarn` 或者 `ayarn`（[阿里内网](https://web.npm.alibaba-inc.com/package/@ali/yarn)）安装依赖
2. 小程序 IDE 打开组件（[下载地址](https://opendocs.alipay.com/mini/ide/download)）

## 更多命令

* `miapp newbranch`: 新建分支
* `miapp push`: 提交代码
* `miapp prepub`: 预发（发布 beta 版本）
* `miapp publish`: 正式发布