车辆信息 Vehicle
Vehicle API 提供车辆档案和状态查询能力。
在线试用
点击上方按钮加载数据
导入
ts
import woo from 'mini-sdk'
// 或
import { vehicle } from 'mini-sdk'API 列表
getCurrentVehicleProfile
获取当前绑定车辆的档案信息。
ts
const profile = await woo.getCurrentVehicleProfile()返回值 VehicleProfile:
| 字段 | 类型 | 说明 |
|---|---|---|
vin | string | 车辆识别码 |
brand | string | 品牌 |
model | string | 型号 |
year | number | 年份 |
color | string | 颜色 |
licensePlate | string | 车牌号 |
ts
const profile = await woo.getCurrentVehicleProfile()
console.log(`${profile.brand} ${profile.model} (${profile.year})`)getCurrentVehicleStatus
获取当前车辆的实时状态。
ts
const status = await woo.getCurrentVehicleStatus()返回值 VehicleStatus:
| 字段 | 类型 | 说明 |
|---|---|---|
mileage | number | 总里程 (km) |
fuelLevel | number | 油量百分比 |
batteryLevel | number | 电量百分比 |
isLocked | boolean | 是否锁车 |
location | { lat: number, lng: number } | 车辆位置 |
ts
const status = await woo.getCurrentVehicleStatus()
if (status.fuelLevel < 20) {
woo.showToast({ title: '油量不足,请及时加油', icon: 'none' })
}API 速查表
| 方法 | 说明 | 签名 |
|---|---|---|
getVehicleInfo | 获取车辆基本信息 | () → Promise<VehicleInfo> |
getVehicleStatus | 获取车辆实时状态 | () → Promise<VehicleStatus> |
onVehicleStatusChange | 监听车辆状态变化 | (callback) → void |