42 lines
1007 B
Markdown
42 lines
1007 B
Markdown
# @zhst/slave
|
|
|
|
## 介绍
|
|
|
|
供微前端应用使用的公共方法
|
|
|
|
## 安装
|
|
|
|
> pnpm install @zhst/slave
|
|
|
|
## 使用
|
|
|
|
```js
|
|
import React from 'react';
|
|
import from '@zhst/slave'
|
|
|
|
slave.init({
|
|
jumpUrl: `http://10.0.0.222:30058/metarial/login`,
|
|
jumpToLogin: false,
|
|
tokenKey: 'token',
|
|
showMsg: false,
|
|
msgText: '你能不能先登录?'
|
|
})
|
|
```
|
|
|
|
## API
|
|
|
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
| --- | --- | --- | --- | --- |
|
|
| jumpToLogin | 是否打开登录校验跳转 | boolean | true | - |
|
|
| jumpUrl | 登录跳转页面 | string | - | - |
|
|
| tokenKey | 从链接获取的登录校验字段 | string | token | - |
|
|
| showMsg | 是否显示“请先登录”提示框 | boolean | true | - |
|
|
| msgText | 提示框自定义文案 | string | 请先登录 | - |
|
|
|
|
## slave 实例方法
|
|
|
|
| 方法 | 说明 | 类型 | 默认值 | 版本 |
|
|
| --- | --- | --- | --- | --- |
|
|
| init | 初始化实例 | function | (data: SlaveProps) => void | - |
|
|
| logOut | 退出登录 | function | () => void | - |
|