91act-auth

91ACT FE AUTH PACKAGE

Usage no npm install needed!

<script type="module">
  import 1actAuth from 'https://cdn.skypack.dev/91act-auth';
</script>

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>