interface.uts 5.7 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
   * 是否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 已提交
228 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 270 271 272 273 274 275 276 277 278 279 280 281 282
   * }
   */
  isUSBDebugging?: boolean,
}


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


export interface Uni {
  /**
    * GetDeviceInfo(Object object)
DCloud-yyl's avatar
DCloud-yyl 已提交
283
    * @description 
DCloud-yyl's avatar
DCloud-yyl 已提交
284 285 286 287
    * 获取设备信息
    * @param {GetDeviceInfoOptions} options [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
    * @return {object}
    * @tutorial https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html
DCloud-yyl's avatar
DCloud-yyl 已提交
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
    * @uniPlatform
	* {
	* 	"app": {
	* 		"android": {
	* 			"osVer": "5.0",
	* 			"uniVer": "√",
	* 			"unixVer": "3.9+"
	* 		},
	* 		"ios": {
	* 			"osVer": "12.0",
	* 			"uniVer": "√",
	* 			"unixVer": "4.11"
	* 		}
	* 	},
  *   "web": {
  *     "uniVer": "√",
  *     "unixVer": "4.0"
  *   }
	* }
  * @example
DCloud-yyl's avatar
DCloud-yyl 已提交
308 309 310 311 312 313 314 315
     ```typescript
      uni.getDeviceInfo({
        filter:[]
      })
     ```
    */
  getDeviceInfo(options?: GetDeviceInfoOptions | null): GetDeviceInfoResult;
}