interface.uts 8.1 KB
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1 2 3 4 5 6 7 8 9
export type GetDeviceInfoOptions = {
  /**
   * @description 过滤字段的字符串数组,假如要获取指定字段,传入此数组。
   */
  filter: Array<string>
}

export type GetDeviceInfoResult = {
  /**
DCloud-yyl's avatar
DCloud-yyl 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
   * 设备品牌
   * @deprecated 已废弃,仅为了向下兼容保留
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.11"
   * 		}
   * 	}
   * }
DCloud-yyl's avatar
DCloud-yyl 已提交
28 29 30
   */
  brand?: string
  /**
DCloud-yyl's avatar
DCloud-yyl 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
   * 设备品牌
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.11"
   * 		}
   * 	}
   * }
DCloud-yyl's avatar
DCloud-yyl 已提交
48 49 50
   */
  deviceBrand?: string,
  /**
DCloud-yyl's avatar
DCloud-yyl 已提交
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
   * 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.11"
   * 		}
   * 	}
   * }
DCloud-yyl's avatar
DCloud-yyl 已提交
68 69 70
   */
  deviceId?: string,
  /**
DCloud-yyl's avatar
DCloud-yyl 已提交
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
   * 设备型号	
   * @deprecated 已废弃,仅为了向下兼容保留
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.11"
   * 		}
   * 	}
   * }
DCloud-yyl's avatar
DCloud-yyl 已提交
89 90 91
   */
  model?: string,
  /**
DCloud-yyl's avatar
DCloud-yyl 已提交
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
   * 设备型号	
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.11"
   * 		}
   * 	}
   * }
DCloud-yyl's avatar
DCloud-yyl 已提交
109 110 111
   */
  deviceModel?: string,
  /**
DCloud-yyl's avatar
DCloud-yyl 已提交
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
   * 设备类型phone、pad、pc	
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.11"
   * 		}
   * 	}
   * }
DCloud-yyl's avatar
DCloud-yyl 已提交
129 130 131
   */
  deviceType?: string,
  /**
DCloud-yyl's avatar
DCloud-yyl 已提交
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
   * 设备方向 竖屏 portrait、横屏 landscape	
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.11"
   * 		}
   * 	}
   * }
DCloud-yyl's avatar
DCloud-yyl 已提交
149 150 151
   */
  deviceOrientation?: string,
  /**
DCloud-yyl's avatar
DCloud-yyl 已提交
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
   * 设备像素比	
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.11"
   * 		}
   * 	}
   * }
DCloud-yyl's avatar
DCloud-yyl 已提交
169 170 171
   */
  devicePixelRatio?: string,
  /**
DCloud-yyl's avatar
DCloud-yyl 已提交
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
   * 操作系统及版本	
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.11"
   * 		}
   * 	}
   * }
DCloud-yyl's avatar
DCloud-yyl 已提交
189 190 191
   */
  system?: string,
  /**
DCloud-yyl's avatar
DCloud-yyl 已提交
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
   * 客户端平台	
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.11"
   * 		}
   * 	}
   * }
DCloud-yyl's avatar
DCloud-yyl 已提交
209 210 211
   */
  platform?: string,
  /**
DCloud-yyl's avatar
DCloud-yyl 已提交
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
   * 是否root
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "x",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.11"
   * 		}
   * 	}
   * }
DCloud-yyl's avatar
DCloud-yyl 已提交
229 230 231
   */
  isRoot?: boolean,
  /**
DCloud-yyl's avatar
DCloud-yyl 已提交
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
   * 是否是模拟器
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "x",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.11"
   * 		}
   * 	}
   * }
DCloud-yyl's avatar
DCloud-yyl 已提交
249 250 251 252
   */
  isSimulator?: boolean,
  /**
   * adb是否开启
DCloud-yyl's avatar
DCloud-yyl 已提交
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "x",
   * 			"unixVer": "√"
   * 		},
   * 		"ios": {
   * 			"osVer": "x",
   * 			"uniVer": "x",
   * 			"unixVer": "x"
   * 		}
   * 	}
DCloud-yyl's avatar
DCloud-yyl 已提交
268 269
   * }
   */
DCloud-yyl's avatar
DCloud-yyl 已提交
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
  isUSBDebugging?: boolean,
  /**
   * 系统名称	
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		}
   * 	}
   * }
   */
  osName?: 'ios' | 'android' | 'mac' | 'windows' | 'linux' | null,
  /**
   * 操作系统版本。如 ios 版本,andriod 版本
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		}
   * 	}
   * }
   */
  osVersion?: string | null,
  /**
   * 操作系统语言
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		}
   * 	}
   * }
   */
  osLanguage?: string | null,
  /**
   * 操作系统主题
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		}
   * 	}
   * }
   */
  osTheme?: 'light' | 'dark' | null,
  /**
   * Android 系统API库的版本。
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		},
   * 		"ios": {
   * 			"osVer": "x",
   * 			"uniVer": "x",
   * 			"unixVer": "x"
   * 		}
   * 	}
   * }
   */
  osAndroidAPILevel?: number | null,
  /**
   * rom 名称。Android 部分机型获取不到值。iOS 恒为 `ios`
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		}
   * 	}
   * }
   */
  romName?: string | null,
  /**
   * rom 版本号。Android 部分机型获取不到值。iOS 为操作系统版本号(同 `osVersion`)。
   * 
   * @uniPlatform
   * {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "x",
   * 			"unixVer": "4.18"
   * 		}
   * 	}
   * }
   */
  romVersion?: string | null,
DCloud-yyl's avatar
DCloud-yyl 已提交
411 412 413 414 415 416 417 418 419 420 421 422
}


/**
 * @param [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
 */
export type GetDeviceInfo = (options?: GetDeviceInfoOptions | null) => GetDeviceInfoResult;


export interface Uni {
  /**
    * GetDeviceInfo(Object object)
DCloud-yyl's avatar
DCloud-yyl 已提交
423
    * @description 
DCloud-yyl's avatar
DCloud-yyl 已提交
424 425 426 427
    * 获取设备信息
    * @param {GetDeviceInfoOptions} options [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
    * @return {object}
    * @tutorial https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html
DCloud-yyl's avatar
DCloud-yyl 已提交
428 429 430 431 432 433 434 435 436
    * @uniPlatform
	* {
	* 	"app": {
	* 		"android": {
	* 			"osVer": "5.0",
	* 			"uniVer": "√",
	* 			"unixVer": "3.9+"
	* 		},
	* 		"ios": {
DCloud-yyl's avatar
DCloud-yyl 已提交
437
	* 			"osVer": "12.0",
DCloud-yyl's avatar
DCloud-yyl 已提交
438
	* 			"uniVer": "√",
DCloud-yyl's avatar
DCloud-yyl 已提交
439
	* 			"unixVer": "4.11"
DCloud-yyl's avatar
DCloud-yyl 已提交
440 441 442 443 444 445 446 447
	* 		}
	* 	},
  *   "web": {
  *     "uniVer": "√",
  *     "unixVer": "4.0"
  *   }
	* }
  * @example
DCloud-yyl's avatar
DCloud-yyl 已提交
448 449 450 451 452 453 454 455
     ```typescript
      uni.getDeviceInfo({
        filter:[]
      })
     ```
    */
  getDeviceInfo(options?: GetDeviceInfoOptions | null): GetDeviceInfoResult;
}