|
|
安装插件- 在App.vue中onESCreate方法
- // 等待TextV2Component插件安装完成后再进入页面
- return new Promise<void>((resolve) => {
- // 注册TextV2Component组件用于自定义字体
- const pluginInfo: ESPluginInfo = {
- pkg: 'eskit.plugin.textv2',
- }
- // 创建插件安装监听器
- const installListener: ESPluginListener = {
- onPluginInstallSuccess(pkg: string, status: number, msg: string) {
- console.log(`TextV2Component插件安装成功: ${pkg}, status: ${status}, msg: ${msg}`)
- registerTextV2Component(app)
- resolve()
- },
- onPluginInstallProgress(pkg: string, status: number, current: number, total: number) {
- console.log(`TextV2Component插件安装进度: ${pkg}, 进度: ${current}/${total}`)
- },
- onPluginInstallError(pkg: string, status: number, msg: string) {
- console.error(`TextV2Component插件安装失败: ${pkg}, status: ${status}, msg: ${msg}`)
- // 即使安装失败也继续,避免页面卡死
- registerTextV2Component(app)
- resolve()
- }
- }
- plugin.addListener(pluginInfo, installListener)
- plugin.installPlugin(pluginInfo)
- }).then(() => {
- // 插件安装完成后初始化请求管理器
- return Promise.resolve()
- })
复制代码
|
|