使用返回键关闭模态框的 vue 插件
npm install vue-native-back --save
# or
yarn add vue-native-back
import Vue from "vue";
import NativeBack from "vue-native-back";
Vue.use(NativeBack);
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;
}
}
See src/
Property | Description | Type | Default |
---|---|---|---|
enable | 是否启动插件 | boolean | true |
Property | Description | Type | Default |
---|---|---|---|
state | 模态框的显示状态 | Array<boolean> | [] |
closeMethods | 模态框的关闭方法 | Array<Function> | [] |
# dev
npm run serve
# build
npm run build:lib