vue-auto-logout
v1.0.1
Published
The vue project session of the permission system timed out to log out
Downloads
25
Readme
English | 简体中文
vue-auto-logout
Project
The vue
project with login function will be automatically logged out of the system if it has not been operated for a long time.The conditions are as follows:
- The
Vue
project of theWeb on the PC side
- The system has a permission mechanism related to the
login function
- The login identifiers such as
token
are stored in thebrowser arbitrary cache
Install
$ npm install vue-auto-logout
or
$ yarn add vue-auto-logout -S
Usage
main.js:
import { createApp } from 'vue'
import App from './app'
import logoutPlugin from 'vue-auto-logout'
const app = createApp(App)
const logoutOptions = {
stagnateTime: 30 * 60 * 1000,
detectTime: 30 * 60
}
app.use(logoutPlugin, logoutOptions)
app.mount('#app')
Logout Options
| key | description | default | options |
| :-- | --- | --- | --- |
| enable
| Turn on automatic logout | true
| Boolean
|
| keyName
| The key
name of the token
in the cache | token
| String
|
| clearAll
| Whether to clear all cached values under this site | true
| Boolean
|
| stagnateTime
| No operation dead time | 30min
| Number
|
| detectTime
| How many seconds to check whether to log out | 10s
| Number
|