根据deviceInfo模块进行定位,发现应用展示设备信息时查询的字段为deviceInfo.brand,因此展示仅为品牌名,并非查询deviceInfo.marketName(设备的外部产品系列)。
建议应用查询设备信息的查询字段设置为deviceInfo.marketName,展示足够的信息,示例代码:
import { deviceInfo } from '@kit.BasicServicesKit';
@Entry
@Component
struct DeviceInfoPage {
@State brandInfo: string = '未知';
@State marketNameInfo: string = '未知';
aboutToAppear() {
// 获取设备信息
this.brandInfo = deviceInfo.brand;
// 输出结果:the value of the brand is :HUAWEI
console.info('the value of the device brand is :' + this.brandInfo);
this.marketNameInfo = deviceInfo.marketName;
// 输出结果:the value of the marketName is :Mate XX
console.info('the value of the deviceInfo marketName is :' + this.marketNameInfo);
}
build() {
Column() {
Text(`品牌:${this.brandInfo}`)
.fontSize(18)
.margin(10)
.fontWeight(FontWeight.Bold)
Text(`市场型号:${this.marketNameInfo}`)
.fontSize(18)
.margin(10)
.fontWeight(FontWeight.Bold)
}
.height('100%')
.width('100%')
.padding(20)
.justifyContent(FlexAlign.Center)
}
}