vue-native-back

0.1.6 • Public • Published

vue-native-back NPM version NPM downloads issues

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

Demo

Install

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

Usage

vue2.0

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

Vue.use(NativeBack);

vue3.0

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

createApp(App).use(NativeBack);
<native-back
  :state="[visibleAlert, visibleConfirm]"
  :closeMethods="[onCloseAlert, onCloseConfirm]"
/>
  data() {
    return {
      visibleAlert: false,
      visibleConfirm: false
    };
  },
  methods: {
    onCloseAlert() {
      this.visibleAlert = false;
    },
    onCloseConfirm() {
      this.visibleConfirm = false;
    }
  }

Example

See src/

Options

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

Props

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

Development

# dev
npm run serve

# build
npm run build:lib

License

MIT

Package Sidebar

Install

npm i vue-native-back

Weekly Downloads

4

Version

0.1.6

License

MIT

Unpacked Size

51.3 kB

Total Files

14

Last publish

Collaborators

  • luoxuhai