插件名称 | vue-prevent-unload |
---|---|
发布时间 | 2020年7月28日 |
插件作者 | probil |
一个Vue 2+组件,有条件地防止页面离开/重新加载在web应用程序。
# NPM
$ npm install vue-prevent-unload --save
<template>
<PreventUnload :when="hasChanges"/>
</template>
<script>
import PreventUnload from 'vue-prevent-unload';
export default {
data() {
return {
hasChanges: true,
}
},
components: {
PreventUnload,
}
}
</script>