💬
输入需求
所有 AI 功能均通过 DeepSeek 大模型驱动,API Key 已内置,可直接使用。
💻
生成结果
✨
代码将在这里显示
写代码
所有 AI 功能均通过 DeepSeek 大模型驱动,API Key 已内置,可直接使用。
💡 点击任意卡片查看详细知识体系与代码示例,或使用下方输入框自定义探索
本工具所有 AI 功能均通过 DeepSeek 大模型驱动。API Key 已内置配置,所有功能可直接使用。
📩 如有建议或问题,欢迎通过 hedinghua@wtc.edu.cn 交流。
本工具是《鸿蒙应用开发》学伴,提供 AI 驱动的代码生成、知识图谱、代码解释、错误诊断、API 速查和组件指南等功能。所有 AI 功能均基于 DeepSeek 大模型,API Key 已自动配置,打开即用。
DeepSeek API Key 已内置,无需手动配置。所有 AI 功能可直接调用,开箱即用。
版本: v1.1.0 | 更新日期: 2025-3-19
人工智能学院教授 | 鸿蒙应用开发爱好者
何定华,人工智能学院教授,热爱鸿蒙生态,专注于鸿蒙项目开发。致力于在教学中使用真实案例和把AI技术应用于教学案例。何定华是《HarmonyOS应用开发者高级认证证书》和《鸿蒙应用开发培训讲师》、《Web前端高级证书》等证书获得者。
📧 hedinghua@wtc.edu.cn。13720187939
人工智能学院副教授 | 工业软件专业负责人
杨艳,人工智能学院副教授,工业软件专业负责人。热爱鸿蒙生态。擅长于教学研究,在把AI技术应用于真实教学案例方面有独到的理解。杨艳是《HarmonyOS应用开发者高级认证证书》等证书获得者。
📧 yangyan@wtc.edu.cn
Text('Hello HarmonyOS')
.fontSize(20)
.fontColor('#fff')
.fontWeight(FontWeight.Bold)
.maxLines(2)
.textOverflow({overflow:TextOverflow.Ellipsis})
Button('点击', {type:ButtonType.Capsule})
.width('90%').height(40)
.fontSize(16)
.backgroundColor(0x317aff)
.onClick(() => {
console.log('clicked')
})
TextInput({placeholder:'请输入'})
.width('90%').height(40)
.type(InputType.Normal)
.onChange((value) => {
this.inputValue = value
})
Image($r('app.media.icon'))
.width(100).height(100)
.borderRadius(10)
.objectFit(ImageFit.Cover)
.alt($r('app.media.loading'))
Column({space:10}) {
Text('A').fontSize(16)
Text('B').fontSize(16)
}
.width('100%')
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Center)
Row({space:10}) {
Text('A').fontSize(16)
Text('B').fontSize(16)
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Center)
Stack({alignContent:Alignment.Center}){
Image($r('app.media.bg'))
.width('100%').height(200)
Text('封面标题')
.fontSize(24).fontColor('#fff')
.fontWeight(FontWeight.Bold)
}
Flex({wrap:FlexWrap.Wrap,
justifyContent:FlexAlign.SpaceAround}){
ForEach(this.tags,(tag)=>{
Text(tag)
.padding({l:12,r:12,t:6,b:6})
.backgroundColor('#333')
.borderRadius(16)
.margin(6)
})
}
Grid() {
ForEach(this.items,(item)=>{
GridItem() {
Image(item.img).width('100%')
}
})
}
.columnsTemplate('1fr 1fr 1fr')
.rowsGap(10).columnsGap(10)
Scroll() {
Column() {
ForEach(this.data,(item)=>{
Text(item).height(60)
})
}
.width('100%')
}
.scrollBar(BarState.Auto)
.scrollable(ScrollDirection.Vertical)
List() {
ForEach(this.items,(item)=>{
ListItem() {
Row() {
Text(item.name).layoutWeight(1)
Text(item.time).fontColor('#999')
}.width('100%').padding(16)
}
})
}
.divider({strokeWidth:1,color:'#222'})
.scrollBar(BarState.Auto)
Swiper() {
Image($r('app.media.banner1'))
Image($r('app.media.banner2'))
Image($r('app.media.banner3'))
}
.width('100%').height(180)
.autoPlay(true).interval(3000)
.indicator(true).loop(true)
Tabs({barPosition:BarPosition.Start}){
TabContent() { Text('首页内容') }
.tabBar('首页')
TabContent() { Text('分类内容') }
.tabBar('分类')
TabContent() { Text('我的内容') }
.tabBar('我的')
}
.width('100%').height('100%')
Badge({
count:99,
maxCount:99,
position:BadgePosition.RightTop,
style:{badgeSize:18,fontSize:12}
}) {
Image($r('app.media.msg'))
.width(36).height(36)
}
Column() {
Text('上方内容')
Divider()
.strokeWidth(1)
.color('#333')
.margin({top:12,bottom:12})
Text('下方内容')
}
Toggle({type:ToggleType.Switch,
isOn:this.isEnabled})
.selectedColor('#00d4ff')
.onChange((isOn)=>{
this.isEnabled = isOn
console.log('开关状态:'+isOn)
})
Row({space:20}) {
Radio({value:'opt1',group:'grp'})
.checked(this.choice==='A')
.onChange(()=>this.choice='A')
Text('选项A')
Radio({value:'opt2',group:'grp'})
.checked(this.choice==='B')
.onChange(()=>this.choice='B')
Text('选项B')
}
Row() {
Checkbox()
.select(this.isChecked)
.selectedColor('#00d4ff')
.onChange((val)=>{
this.isChecked = val
})
Text('同意协议').fontSize(14)
}
Slider({
value:this.volume,
min:0,max:100,step:1
})
.width('90%')
.showTips(true)
.blockColor('#00d4ff')
.trackColor('#222')
.onChange((val)=>{
this.volume = val
})
Progress({
value:this.current,
total:this.total,
type:ProgressType.Linear
})
.width('90%').height(8)
.color('#00d4ff')
.backgroundColor('#222')
if (this.isLoading) {
LoadingProgress()
.width(40).height(40)
.color('#00d4ff')
} else {
List() { /* 列表内容 */ }
}
Select(this.cityOptions)
.selected(this.cityIndex)
.value(this.city)
.onSelect((idx,val)=>{
this.cityIndex = idx
this.city = val
})
// data: cityOptions = [
// {value:'北京'},{value:'上海'}
// ]
Search({
placeholder:'搜索内容',
value:this.keyword
})
.width('90%').height(44)
.backgroundColor('#1a1a2e')
.onChange((val)=>{
this.keyword = val
})
.onSubmit(()=>{
this.doSearch()
})
Rating({rating:this.score,
indicator:false})
.stars(5)
.stepSize(0.5)
.starStyle({
offUri:'/star_off.png',
onUri:'/star_on.png'
})
.onChange((val)=>{
this.score = val
})
DatePicker({
selected:this.birthDate
})
.lunar(false)
.onChange((val)=>{
this.birthDate = new Date(
val.year,val.month,val.day
)
})
TimePicker({
selected:this.remindTime
})
.useMilitaryTime(true)
.onChange((val)=>{
this.remindTime = new Date(
0,0,0,val.hour,val.minute
)
})
Stepper({index:this.stepIdx}){
StepperItem() {
Text('填写信息') // 步骤1
}.nextLabel('下一步')
StepperItem() {
Text('确认订单') // 步骤2
}.prevLabel('上一步')
.nextLabel('提交')
}
Button('更多')
.bindMenu([
{value:'编辑',action:()=>this.edit()},
{value:'删除',action:()=>this.del()},
{value:'分享',action:()=>this.share()}
])
@CustomDialog
struct ConfirmDialog {
controller:CustomDialogController
confirm?:()=>void
build(){
Column(){
Text('确认删除?').margin(20)
Row({space:20}){
Button('取消').onClick(()=>
this.controller.close())
Button('确定').onClick(()=>{
this.confirm?.()
this.controller.close()
})
}
}.padding(20)
}
}
Row(){
Text('左侧').fontSize(16)
Blank() // 自动占据剩余空间
Text('右侧').fontSize(16)
}
.width('100%').padding(16)
// 类似 CSS 的 flex:1 效果
Refresh({refreshing:this.isRefreshing}){
List(){
ForEach(this.list,(item)=>{
ListItem(){ Text(item.title) }
})
}
}
.onRefreshing(()=>{
this.loadData().then(()=>{
this.isRefreshing = false
})
})
TextArea({
placeholder:'请输入内容',
text:this.content
})
.width('90%').height(120)
.maxLength(500)
.showCounter(true)
.onChange((val)=>{
this.content = val
})
Marquee({
start: this.play,
step: 4,
loop: -1,
fromStart: true,
src: '这是一条滚动的公告通知文本'
})
.width('90%')
.fontSize(14)
.fontColor('#00d4ff')
.backgroundColor('#1a1a2e')
.padding(8)
.borderRadius(6)
Gauge({ value: 72, min: 0, max: 100 })
.width(160).height(160)
.startAngle(210).endAngle(150)
.colors([
{ color: '#e17055', ratio: 0.3 },
{ color: '#fdcb6e', ratio: 0.3 },
{ color: '#00d4ff', ratio: 0.4 }
])
.strokeWidth(16)
.trackColor('#222')
.description('CPU 使用率')
PatternLock(this.patternLockController)
.sideLength(280)
.circleRadius(10)
.regularColor('#444')
.activeColor('#00d4ff')
.selectedColor('#00d4ff')
.pathStrokeWidth(4)
.autoReset(true)
.onPatternComplete((input) => {
if (input === this.password) {
this.message = '解锁成功'
return true
} else {
this.message = '图案错误'
return false
}
})
AlphabetIndexer({
arrayValue: this.contactList,
selected: this.selectedIndex
})
.width(32)
.fontSize(12)
.fontColor('#666')
.selectedFontColor('#00d4ff')
.selectedBackgroundColor('rgba(0,212,255,0.15)')
.usingPopup(true)
.alignStyle(IndexerAlign.Right)
.onSelected((index) => {
this.selectedIndex = index
this.scrollToContact(index)
})