预览器、模拟器、真机调试(搭载鸿蒙Next系统+开启USB调试+连接电脑)
ArkTS基于TS开发规则,同时进行封装,采用声明式开发模式
TS是微软设计的JS语言超集,涵盖了JS核心的ES5/6内容,增加了静态检查、类型推断等
1.文件后缀名是ets,提供各种装饰器强化组件功能
2.通过Struct定义一个组件,采用面向对象开发规则
3.可以自定义组件,或者使用ArkUI官方组件
4.可以给组件绑定事件,提供完整事件机制
5.通过ArkCompiler(方舟编译器)加载运行
华为自研,统一编程平台,包含编译器、工具链、运行时等组件
提前解析编译代码,支持多种高级语言和多芯片平台的编译运行
可以将代码运行到手机、平板、车机、智慧屏、手表
前端插件对代码压缩、混淆、Babel转化版本,开发不够规范,运行可能出错
1import { Header } from '../view/Header' 2import formatUtils from '../utils/DateFormat' 3 4@Entry 5@Component 6struct Index { 7 @State message: string = formatUtils.dateFormat(new Date()) 8 9 checkMe = () => { 10 console.log('123') 11 } 12 13 build() { 14 Column() { 15 Text('这是主页面') 16 Text(this.message) 17 Header() 18 Button('循环').onClick(this.checkMe) 19 } 20 } 21}
1import { Header } from '../view/Header' 2import formatUtils from '../utils/DateFormat' 3 4@Entry 5@Component 6struct Index { 7 @State message: string = formatUtils.dateFormat(new Date()) 8 showMsg = () => { 9 let num: number = 100 10 return num 11 } 12 checkMe = () => { 13 for (let index = 0; index <= 100; index++) { 14 if (index % 2 == 0) { 15 console.log(`${index}`) 16 const result = this.showMsg() 17 console.log(`result:${result}`) 18 } 19 } 20 } 21 22 build() { 23 Column() { 24 Text('这是主页面') 25 Text(this.message) 26 Header() 27 Button('循环').onClick(this.checkMe) 28 } 29 } 30}
Copyright ©2010-2022 比特日记 All Rights Reserved.
Powered By 可尔物语