自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数HarmonyOS鸿蒙开发工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年HarmonyOS鸿蒙开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上HarmonyOS鸿蒙开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新
如果你觉得这些内容对你有帮助,可以添加VX:vip204888 (备注鸿蒙获取)
一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.instance;
}
getObject(value: string): Object | undefined {
return this._objects.get(value);
}
setObject(key: string, objectClass: Object): void {
this._objects.set(key, objectClass);
}
}
// xxx.ets
import web_webview from ‘@ohos.web.webview’
import { GlobalContext } from ‘…/GlobalContext’
let url = ‘file://’ + GlobalContext.getContext().getObject(“filesDir”) + ‘/index.html’
@Entry
@Component
struct WebComponent {
controller: web_webview.WebviewController = new web_webview.WebviewController()
build() {
Column() {
// 加载沙箱路径文件。
Web({ src: url, controller: this.controller })
}
}
}
2. 修改EntryAbility.ts。
以filesDir为例,获取沙箱路径。若想获取其他路径,请参考[应用文件路径]( )。
// xxx.ts
import UIAbility from ‘@ohos.app.ability.UIAbility’;
import AbilityConstant from ‘@ohos.app.ability.AbilityConstant’;
import Want from ‘@ohos.app.ability.Want’;
import web_webview from ‘@ohos.web.webview’;
import { GlobalContext } from ‘…/GlobalContext’
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
// 通过在GlobalContext对象上绑定filesDir,可以实现UIAbility组件与UI之间的数据同步。
GlobalContext.getContext().setObject(“filesDir”, this.context.filesDir);
console.log("Sandbox path is " + GlobalContext.getContext().getObject(“filesDir”))
}
}
加载的html文件。
Hello World
```属性
通用属性仅支持aspectRatio、backdropBlur、backgroundColor、bindContentCover、bindContextMenu、bindMenu、bindSheet、borderColor、borderRadius、borderStyle、borderWidth、clip、constraintSize、defaultFocus、focusable、tabIndex、groupDefaultFocus、focusOnTouch、displayPriority、enabled、flexBasis、flexGrow、flexShrink、layoutWeight、id、gridOffset、gridSpan、useSizeType、height、touchable、margin、markAnchor、offset、width、zIndex、visibility、scale、transform、responseRegion、size、stateStyles、opacity、shadow、sharedTransition、transition。
domStorageAccess
domStorageAccess(domStorageAccess: boolean)
设置是否开启文档对象模型存储接口(DOM Storage API)权限,默认未开启。
系统能力: SystemCapability.Web.Webview.Core
参数:
参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
---|---|---|---|---|
domStorageAccess | boolean | 是 | false | 设置是否开启文档对象模型存储接口(DOM Storage API)权限。 |
示例:
// xxx.ets
import web_webview from '@ohos.web.webview'
@Entry
@Component
struct WebComponent {
controller: web_webview.WebviewController = new web_webview.WebviewController()
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
.domStorageAccess(true)
}
}
}
fileAccess
fileAccess(fileAccess: boolean)
设置是否开启应用中文件系统的访问,默认启用。$rawfile(filepath/filename)")中rawfile路径的文件不受该属性影响而限制访问。
参数:
参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
---|---|---|---|---|
fileAccess | boolean | 是 | true | 设置是否开启应用中文件系统的访问,默认启用。 |
示例:
// xxx.ets
import web_webview from '@ohos.web.webview'
@Entry
@Component
struct WebComponent {
controller: web_webview.WebviewController = new web_webview.WebviewController()
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
.fileAccess(true)
}
}
}
imageAccess
imageAccess(imageAccess: boolean)
设置是否允许自动加载图片资源,默认允许。
参数:
参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
---|