上一页 1 2 3 4 5 6 ··· 32 下一页
摘要: 生命周期函数 import router from '@ohos.router' @Entry @Component struct Index { // 页面的生命周期 -- 5个 (如果是组件,则只有前2个;如果是页面则有5个) // 组件有的2个 aboutToAppear() { consol 阅读全文
posted @ 2024-04-13 22:44 我也有梦想呀 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 1、Tabs的基本使用 @Entry @Component struct Index { private controller: TabsController = new TabsController(); // 声明周期函数 aboutToAppear(){ // 页面加载 1s后 跳转到商城 s 阅读全文
posted @ 2024-04-13 22:21 我也有梦想呀 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 1、配置页面路由信息 resources --> base --> profile --> main_pages.json { "src": [ "pages/demo03/Index", "pages/demo03/Detail" ] } 2、编写页面组件 Index.ets /** * 路由跳转 阅读全文
posted @ 2024-04-13 16:55 我也有梦想呀 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 使用前面学习的相关组件和api实现联系人的CRUD; 效果如下 父组件 import { Contacts } from '../domain/Model' import ContactsItem from '../components/ContactsItem' @Entry @Component 阅读全文
posted @ 2024-04-12 22:58 我也有梦想呀 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 注意避坑: (item, index) => index + JSON.stringify(item) 默认写法,不会丢失下标的顺序,但是修改数据顺序时重新加载了,效率低一点 (item, index) => JSON.stringify(item) 这种写法效率虽然高一点,但是修饰了下标的顺序 父 阅读全文
posted @ 2024-04-10 23:06 我也有梦想呀 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 1、Watch监听 类似Vue中的数据监听,监听的数据发生了变化 --> 做啥事情 父组件 import Child07 from '../components/Child07' @Entry @Component struct WatchExample { // watch 可以监听组件状态 St 阅读全文
posted @ 2024-04-09 23:08 我也有梦想呀 阅读(413) 评论(0) 推荐(0) 编辑
摘要: 1、父传子@State和@Prop 父组件 // 导入子组件 import Child01 from '../components/Child01' @Entry @Component struct StateExample { @State count: number = 0 build() { 阅读全文
posted @ 2024-04-05 02:30 我也有梦想呀 阅读(462) 评论(0) 推荐(0) 编辑
摘要: 1、Image图片组件 鸿蒙内置组件Image的4种写法 // 鸿蒙内置Image图片组件案例 @Entry @Component struct ImagePage { build() { Column({space:20}){ // 1、图片的第一种写法 media文件夹下 Image($r('a 阅读全文
posted @ 2024-03-18 22:26 我也有梦想呀 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 需求,点击按钮切换图片 代码: @Entry // 代表组件的入口 (类装饰器) @Component // 代表的自定义的组件 -> 组件配置路由 -> 页面 struct Index { // 定义响应式数据 (属性装饰器) @State isOn: boolean = false; @Stat 阅读全文
posted @ 2024-03-13 20:56 我也有梦想呀 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 1、工具安装 后续补上 2、创建工程 3、点击右侧预览页面进行预览 注意:如果没有预览页面的话我们就勾选出预览窗口 view --> ToolWindows --> Previewer 4、项目运行的三种方式 (1) 预览 (2) 模拟器 (3) 真机 TODO 很抱歉,没有鸿蒙系统的手机...后面 阅读全文
posted @ 2024-03-13 20:19 我也有梦想呀 阅读(10) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 32 下一页
点击右上角即可分享
微信分享提示