0.1.6 • Published 4 years ago

vue-native-back v0.1.6

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

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

PropertyDescriptionTypeDefault
enable是否启动插件booleantrue

Props

PropertyDescriptionTypeDefault
state模态框的显示状态Array\<boolean>[]
closeMethods模态框的关闭方法Array\<Function>[]

Development

# dev
npm run serve

# build
npm run build:lib

License

MIT