diff --git a/鸿蒙.learn/蜗牛学苑/day01.md b/鸿蒙.learn/蜗牛学苑/day01.md new file mode 100644 index 0000000..9b34e89 --- /dev/null +++ b/鸿蒙.learn/蜗牛学苑/day01.md @@ -0,0 +1,67 @@ +### 项目结构 + +src/ +├─ main/ +│ ├─ etc/ +│ │ ├─ entryability/ +│ │ ├─ pages/ +│ │ ├─ entrybackupability/ +│ │ ├─ view/ +│ │ ├─ viewmodel/ +│ │ ├─ apis/ +│ │ ├─ utils/ +│ ├─ resources/ +├─ ohosTest/ +├─ test/ +├─ mock/ + +### 国际化 + +可以根据系统来切换中英文 + + + + + +### ArkTS基础语法 + +枚举 + +联合类型 + +```ts +@State message: string | null = null; +实现键值对表达 +键的类型,值的类型 + @State map: Record = { + 'key1': 'value1', + 'key2': 'value2', + }; +``` + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/鸿蒙.learn/蜗牛学苑/day02.md b/鸿蒙.learn/蜗牛学苑/day02.md new file mode 100644 index 0000000..a197699 --- /dev/null +++ b/鸿蒙.learn/蜗牛学苑/day02.md @@ -0,0 +1,64 @@ +### ArkTS数据绑定和事件 + +ArkTS负责数据维护和交互 + +ArkUI负责页面布局 + +#### 示例焦点技术onBlur和初识双向绑定 + +```js +@Entry +@Component +struct Index { + @State message: string = 'Hello World'; + checkMe = ()=>{ + this.message = "harmonyos" + } + + // inputEvent = (event:ClickEvent)=>{ + // + // } + build() { + RelativeContainer() { + Column(){ + Text(this.message) + Button("点击").onClick(this.checkMe) + .width('100') + .stateEffect(true) + TextInput({placeholder:'请输入内容 ',text:$$this.message}).onBlur(()=>{ + console.log("231") + }) + TextInput() + } + } + .height('100%') + .width('100%') + } +} +``` + +### 实战任务小程序 + +1. ##### 布局单位 + +不是px, + +物理像素 px + +逻辑像素 + +鸿蒙提供多种布局单位 + +px以分辨率为参考 + +vp屏幕密度相关像素 + +fp字体像素 + +lpx视窗逻辑像素 + +2. ##### Column和Row布局 + +Column默认垂直方向为主轴,水平方向为侧轴 + +Row默认水平方向为主轴,垂直方向为侧轴 \ No newline at end of file diff --git a/鸿蒙.learn/蜗牛学苑/day03.md b/鸿蒙.learn/蜗牛学苑/day03.md new file mode 100644 index 0000000..2f0962b --- /dev/null +++ b/鸿蒙.learn/蜗牛学苑/day03.md @@ -0,0 +1,17 @@ +### this指向问题 + +> 1. this永远指向一个对象 +> 2. 普通函数中this,谁调用此函数。则this指向谁 +> 3. 箭头函数默认没有this指向,如果出现,则一定指向父级作用域 + + + + + +### UI往后 + + + + + +### 路由跳转和路由传参 \ No newline at end of file