#鸿蒙学习大百科#如何通过代码获取设备的deviceType?

如何通过代码获取设备的deviceType?


HarmonyOS
2024-09-26 10:02:43
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
重庆大镖客
import { deviceInfo } from '@kit.BasicServicesKit'

@Entry
@Component
struct Index {
  @State deviceType: string = '未知'

  aboutToAppear(): void {
    this.deviceType = deviceInfo.deviceType
  }

  build() {
    Column() {

    }
    .height('100%')
    .width('100%')
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.

分享
微博
QQ
微信
回复
2024-09-26 16:24:59
相关问题