README
安装
npm install 91act-auth -S
基本使用
ActAuth({
initUrl: 'https://password.91act.com/auth/checkLogin',
timeout: 30000,
threshold: 3000,
headerKey: 'x-act',
router: null,
}).then(() => {
// 渲染
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
}).catch(e => {
// 重定向到认证中心
window.location.href = e.message
})
构建环境
典型的vue + element-ui + axios环境
import ActAuth from '91act-auth'
存在webpack等打包工具,但不是vue环境
import ActAuth from '91act-auth/dist/bundle.js'
纯html使用
<script src="yourpath/bundle.js"></script>
<script>
window.onload = () => {
window.ActAuth.default()
}
</script>