1.0.6 • Published 1 year ago
inwu-uikit v1.0.6
使用指南
在 vue3 中使用
1、安装 inwu-uikit
npm run inwu-uikit
2、导入样式
import 'inwu-uikit/style.css';
3、导入 inwu-uikit
import MicronatureInstance from 'inwu-uikit';
4、准备容器
<div id="inwu-container" style="width:1920px; height:1080px"></div>
5、初始化
onMounted(async () => {
let MN = new MicronatureInstance({
url: 'https://******/',
username: '***',
password: '***'
});
await MN.init();
MN.mountElement('inwu-container', 'home');
});
例:在react中使用
1、安装inwu-uikit
npm run inwu-uikit
2、导入样式
import 'inwu-uikit/style.css';
3、导入inwu-uikit并初始化
import MicronatureInstance from 'inwu-uikit';
async function init() {
let MN = new MicronatureInstance ({
url: 'https://******/',
username: '***',
password: '***'
});
await MN.init();
let el = document.querySelector('.Home')
MN.mountElement(el, 'home');
}
function App() {
return (<div className="Home"></div>);
}
export default App;
实例说明
let MN = new MicronatureInstance(initConfig)
Method | Description | |
---|---|---|
MN.init() | 初始化配置 | |
MN.login(username: string, password: string) | 登录 参数: 1、用户名 2、密码 | |
MN.mountComponent(id | HTMLElement, moduleName) | 加载指定模块的文件 参数:1、元素 id 或元素 2、模块名 | |
MN.unmountComponent() | 销毁当前模块 | |
MN.setTheme(‘dark’ | ‘light’) | 切换主题 参数:深色 | 浅色 |
MN.setLang(‘zh’ | ‘en’) | 切换语言 参数:中文 | 英文 |
MN.setProject(projectId) | 切换项目参数:项目 id |
Property | Description |
---|---|
MN.lang: string | 当前语言 |
MN.theme: string | 当前主题样式 |
MN.userInfo: UserInfo | 当前主题样式 |
MN.projectList: ProjectInfo[] | 项目列表 |
MN.currentProject: ProjectInfo | 当前项目 |
MN.el: string | HTMLElement | 当前项目 |
MN.config: InitConfig | 当前配置信息 |
类型/参数说明
initConfig: 初始化配置 | Param | Description | | :--- | :---------- | | initConfig.lang: string | 语言 参数:‘zh’ | ‘en’ 默认:‘zh’ | initConfig.url: string | api 接口 | initConfig.themeStyle: string | 主题样式 参数:‘dark’ | ‘light’ 默认:‘dark | initConfig.username: string | 用户名 | initConfig.password: string | 密码
moduleName: 模块名,选择要加载的模块 | Param | Description | | :--- | :---------- | | home: string | 首页 | area: string | 空间页 | device: string | 设备 | distribution: string | 分配 | group: string | 群组 | scene: string | 场景 | linkage: string | 联动 | schedule: string | 日程 | orderList: string | 订单列表 | orderManage: string | 订单管理 | control: string | 监控、控制页 | energy: string | 能耗页