Skip to content

车辆信息 Vehicle

Vehicle API 提供车辆档案和状态查询能力。

在线试用

getCurrentVehicleProfilegetCurrentVehicleStatus同时获取

点击上方按钮加载数据

车辆 API 试用

拉取当前车辆档案与实时状态,以键值对形式展示(mock 数据)

导入

ts
import woo from 'mini-sdk'
// 或
import { vehicle } from 'mini-sdk'

API 列表

getCurrentVehicleProfile

获取当前绑定车辆的档案信息。

ts
const profile = await woo.getCurrentVehicleProfile()

返回值 VehicleProfile

字段类型说明
vinstring车辆识别码
brandstring品牌
modelstring型号
yearnumber年份
colorstring颜色
licensePlatestring车牌号
ts
const profile = await woo.getCurrentVehicleProfile()
console.log(`${profile.brand} ${profile.model} (${profile.year})`)

getCurrentVehicleStatus

获取当前车辆的实时状态。

ts
const status = await woo.getCurrentVehicleStatus()

返回值 VehicleStatus

字段类型说明
mileagenumber总里程 (km)
fuelLevelnumber油量百分比
batteryLevelnumber电量百分比
isLockedboolean是否锁车
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

MiniDev Studio — 小程序开发利器