Use the return key to close the Vue plug-in of the modal, support Vue3.0

vue-native-back

Use the return key to close the vue plugin of the modal

Demo

CodeSandbox

Install

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

Usage

view2.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 Whether to start the plug-in boolean true

Props

Property Description Type Default
state The display state of the modal box Array []
closeMethods Close method of modal box Array []

Development

# dev
npm run serve

# build
npm run build:lib

Download Details:

Author: luoxuhai

Demo: https://codesandbox.io/s/vuejsyanxi-cgk4l

Source Code: https://github.com/luoxuhai/vue-native-back

#vue #vuejs #javascript

Use the return key to close the Vue plug-in of the modal, support Vue3.0
2.05 GEEK