0.1.6 • Published 4 years ago
vue-native-back v0.1.6
vue-native-back
使用返回键关闭模态框的 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