Webwidget使用说明
1. 开发者文档应用脚手架
1.1 项目描述
1.2 快速开始
1.2.1 环境依赖
1.2.2 安装配置
1.
2.
1.2.2.1 开发环境
1.2.2.2 生产环境
1.
2.
3.
注意:不建议修改打包产物的配置文件!
1.3 为什么选择此脚手架?
1.4 目录结构
1.4.1 目录/文件
1.4.2 核心目录说明
1.5 国际化(I18n)
1.6 SDK文档
1.7 问题反馈
1.8 版权声明
2. SDK使用文档
2.1 概述
2.2 安装
npm install @newcore/client
2.3 导入
import { XHYClient } from '@newcore/client';
2.4 初始化
2.5 方法签名
XHYClient.init(): Promise<Client>
2.6 使用示例
2.7 获取上下文信息
2.7.1 获取位置信息
client.context.location
可以访问应用的位置配置信息。const location = client.context.location;
console.log(location) // TopBar SideBar NavBar
2.7.2 获取语言信息
client.context.language
可以获取当前应用的语言设置。const currentLanguage = client.context.language;
console.log('当前语言:', currentLanguage); // zh-CN en-US
2.8 manifest.json 配置说明
{
"name": "应用名称",
"author": {
"name": "作者名称"
},
"location": {
"topBar": {
"flexible": true,
"size": {
"width": "220px",
"height": "100px"
}
}
},
"version": "应用版本",
"frameworkVersion": "框架版本要求"
}
字段 | 类型 | 必填 | 说明 |
---|---|---|---|
name | string | 是 | 应用名称 |
author | object | 是 | 应用作者信息 |
author.name | string | 是 | 作者名称 |
location | object | 是 | 应用显示位置配置 |
location.topBar | object | 否 | 顶部栏位置配置 |
location.navBar | object | 否 | 导航栏位置配置 |
location.sideBar | object | 否 | 侧边栏位置配置 |
flexible | boolean | 是 | 是否占据父容器 |
size | object | 是 | 容器尺寸配置 |
size.width | string | 是 | 容器宽度(如"220px") |
size.height | string | 是 | 容器高度(如"100px") |
version | string | 是 | 应用版本号 |
frameworkVersion | string | 是 | 所需框架最低版本 |
2.9 注意事项
1.
2.
修改于 2025-06-26 15:41:55