HarmonyOS 鸿蒙Next 关于 HAR HSP 应该如何选择呀?有没有大佬能举一些常见应用例子

HarmonyOS 鸿蒙Next 关于 HAR HSP 应该如何选择呀?有没有大佬能举一些常见应用例子

关于 HAR HSP  应该如何选择呀????,有没有大佬能举一些 常见应用在例子!!!,比如说功能模块,头部 标题和返回按钮


.el-image-viewer__wrapper { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 2147483649 !important; } .el-image-viewer__btn { position: absolute; z-index: 1; display: flex; align-items: center; justify-content: center; border-radius: 50%; opacity: .8; cursor: pointer; box-sizing: border-box; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none } .el-image-viewer__btn .el-icon { font-size: inherit; cursor: pointer } .el-image-viewer__close { top: 60px; right: 40px; width: 40px; height: 40px; font-size: 40px } .el-image-viewer__canvas { position: static; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none } .el-image-viewer__actions { left: 50%; bottom: 30px; transform: translateX(-50%); width: 282px; height: 44px; padding: 0 23px; background-color: #333333; border-color: #fff; border-radius: 22px } .el-image-viewer__actions__inner { width: 100%; height: 100%; text-align: justify; cursor: default; font-size: 23px; color: #fff; display: flex; align-items: center; justify-content: space-around } .el-image-viewer__actions__inner i:nth-child(3), .el-image-viewer__actions__inner i:nth-child(4), .el-image-viewer__actions__inner i:nth-child(5) { display: none; } .el-image-viewer__prev { top: 50%; transform: translateY(-50%); left: 40px; width: 44px; height: 44px; font-size: 24px; color: #fff; background-color: #333333; border-color: #fff } .el-image-viewer__next { top: 50%; transform: translateY(-50%); right: 40px; text-indent: 2px; width: 44px; height: 44px; font-size: 24px; color: #fff; background-color: #333333; border-color: #fff } .el-image-viewer__close { width: 44px; height: 44px; font-size: 24px; color: #fff; background-color: #333333; border-color: #fff } .el-image-viewer__mask { position: absolute; width: 100%; height: 100%; top: 0; left: 0; opacity: .5; background: #000 } .viewer-fade-enter-active { -webkit-animation: viewer-fade-in var(–el-transition-duration); animation: viewer-fade-in var(–el-transition-duration) } .viewer-fade-leave-active { -webkit-animation: viewer-fade-out var(–el-transition-duration); animation: viewer-fade-out var(–el-transition-duration) } @-webkit-keyframes viewer-fade-in { 0% { transform: translate3d(0, -20px, 0); opacity: 0 } 100% { transform: translate3d(0, 0, 0); opacity: 1 } } @keyframes viewer-fade-in { 0% { transform: translate3d(0, -20px, 0); opacity: 0 } 100% { transform: translate3d(0, 0, 0); opacity: 1 } } @-webkit-keyframes viewer-fade-out { 0% { transform: translate3d(0, 0, 0); opacity: 1 } 100% { transform: translate3d(0, -20px, 0); opacity: 0 } } @keyframes viewer-fade-out { 0% { transform: translate3d(0, 0, 0); opacity: 1 } 100% { transform: translate3d(0, -20px, 0); opacity: 0 } } .el-icon-loading { -webkit-animation: rotating 2s linear infinite; animation: rotating 2s linear infinite } .el-icon–right { margin-left: 5px } .el-icon–left { margin-right: 5px } @-webkit-keyframes rotating { 0% { transform: rotateZ(0) } 100% { transform: rotateZ(360deg) } } @keyframes rotating { 0% { transform: rotateZ(0) } 100% { transform: rotateZ(360deg) } } .el-icon { --color: inherit; height: 1em; width: 1em; line-height: 1em; display: inline-flex; justify-content: center; align-items: center; position: relative; fill: currentColor; color: var(–color); font-size: inherit } .el-icon.is-loading { -webkit-animation: rotating 2s linear infinite; animation: rotating 2s linear infinite } .el-icon svg { height: 1em; width: 1em }


更多关于HarmonyOS 鸿蒙Next 关于 HAR HSP 应该如何选择呀?有没有大佬能举一些常见应用例子的实战教程也可以访问 https://www.itying.com/category-93-b0.html

4 回复

关于包类型的选择,可以参考https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V13/application-package-structure-stage-V13#%E9%80%89%E6%8B%A9%E5%90%88%E9%80%82%E7%9A%84%E5%8C%85%E7%B1%BB%E5%9E%8B

har主要使用场景:二方库、三方库。

HSP主要使用场景:元服务分包预加载、按需加载。

更多关于HarmonyOS 鸿蒙Next 关于 HAR HSP 应该如何选择呀?有没有大佬能举一些常见应用例子的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


如图所示,如果只是作为三方库、二方库的话就选HAR包

在选择HAR和HSP时,开发者需根据具体的应用场景和需求来决定。

HAR(HarmonyOS Ability Resource)通常指的是HarmonyOS应用中定义的各种能力和资源,它是应用实现特定功能的基础。而HSP(HarmonyOS Service Package)则更侧重于服务层面,它允许开发者将应用中的某些功能或服务以独立包的形式提供,从而实现更灵活的部署和更新。

以社交类应用为例,如QQ和微信,它们可能需要使用HAR来定义用户登录、好友列表、消息通知等功能和资源。而对于一些提供后台服务的应用,如支付宝的支付服务或高德地图的导航服务,它们可能会选择使用HSP来将这些服务以独立包的形式提供给其他应用调用。

此外,开发者还可以根据应用的跨设备协同需求来选择HAR和HSP。例如,在创建一个支持手机与平板跨屏协同的笔记应用时,可以利用HarmonyOS的分布式能力,通过HSP将笔记同步服务独立出来,从而实现跨设备的笔记同步功能。

如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html

回到顶部