# vue-native-back

> 使用返回键关闭模态框的 vue 插件

Latest version **0.1.6** (published 2020-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-native-back
pnpm add vue-native-back
yarn add vue-native-back
bun add vue-native-back
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2020-10-31 |
| First published | 2020-10-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 50.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | luoxuhai |
| Maintainers | luoxuhai |
| Keywords | vue, vue-router, native-back |

## Links

- npm: https://www.npmjs.com/package/vue-native-back
- Repository: https://github.com/luoxuhai/vue-native-back
- Homepage: https://github.com/luoxuhai/vue-native-back#readme
- Issues: https://github.com/luoxuhai/vue-native-back/issues
- npm.io page: https://npm.io/package/vue-native-back

## Dependencies (3)

- [vue](https://npm.io/package/vue.md) ^2.6.11
- [vuesax](https://npm.io/package/vuesax.md) ^4.0.1-alpha.24
- [core-js](https://npm.io/package/core-js.md) ^3.6.5

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 0.1.6 (latest) — 2020-10-31
- 0.1.5 — 2020-10-28
- 0.1.0 — 2020-10-23

## README

# vue-native-back [![NPM version](https://img.shields.io/npm/v/vue-native-back)](https://npmjs.com/package/vue-native-back) [![NPM downloads](https://img.shields.io/npm/dm/vue-native-back)](https://npmjs.com/package/vue-native-back) [![issues](https://img.shields.io/npm/l/vue-native-back)](https://github.com/luoxuhai/vue-native-back/blob/master/LICENSE)

> 使用返回键关闭模态框的 vue 插件

## Demo

- [在线演示](https://suspicious-neumann-53c4f5.netlify.app)
- [CodeSandbox](https://codesandbox.io/s/vuejsyanxi-cgk4l)

## Install

```bash
npm install vue-native-back --save
# or
yarn add vue-native-back
```

## Usage

### vue2.0

```js
import Vue from "vue";
import NativeBack from "vue-native-back";

Vue.use(NativeBack);
```

### vue3.0

```js
import { createApp } from "vue";
import NativeBack from "vue-native-back";
import App from "./App.vue";

createApp(App).use(NativeBack);
```

```html
<native-back
  :state="[visibleAlert, visibleConfirm]"
  :closeMethods="[onCloseAlert, onCloseConfirm]"
/>
```

```js
  data() {
    return {
      visibleAlert: false,
      visibleConfirm: false
    };
  },
  methods: {
    onCloseAlert() {
      this.visibleAlert = false;
    },
    onCloseConfirm() {
      this.visibleConfirm = false;
    }
  }
```

## Example

See [src/](https://github.com/luoxuhai/vue-native-back/blob/master/src)

## Options

| Property | Description  | Type    | Default |
| -------- | ------------ | ------- | ------- |
| enable   | 是否启动插件 | boolean | true    |

## Props

| Property     | Description      | Type              | Default |
| ------------ | ---------------- | ----------------- | ------- |
| state        | 模态框的显示状态 | Array\<boolean\>  | []      |
| closeMethods | 模态框的关闭方法 | Array\<Function\> | []      |

## Development

```bash
# dev
npm run serve

# build
npm run build:lib
```

## License

[MIT](https://github.com/luoxuhai/vue-native-back/blob/master/LICENSE)

---
_Source: https://npm.io/package/vue-native-back · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
