运行环境模块
数据结构
ESRuntimeDeviceInfo
运行环境信息
参数 | 描述 | 类型 | 非空 |
---|---|---|---|
deviceId | 设备ID | string | 是 |
deviceType | 设备类型 | string | 是 |
接口
getRuntimeDeviceInfo
该方法获取运行环境信息。
完整方法声明:function getRuntimeDeviceInfo(): ESRuntimeDeviceInfo | null
- 参数:
无
- 返回值:
属性 | 描述 | 类型 | 默认值 |
---|---|---|---|
无 | 运行环境信息 | ESRuntimeDeviceInfo | null |
getRuntimeDeviceId
该方法获取运行环境唯一标识符。
完整方法声明:function getRuntimeDeviceId(): string | null
- 参数:
无
- 返回值:
属性 | 描述 | 类型 | 默认值 |
---|---|---|---|
无 | 运行环境唯一标识符 | string | null |
getRuntimeDeviceType
该方法获取运行环境类型。
完整方法声明:function getRuntimeDeviceType(): string | null
- 参数:
无
- 返回值:
属性 | 描述 | 类型 | 默认值 |
---|---|---|---|
无 | 运行环境类型 | string | null |
基础用法
- 代码示例:
点击查看源码
vue<template> <div class='es-sdk-root-css'> <s-title-view class='es-sdk-content-title-css' :text='this.$options.name' /> <div class='es-sdk-content-divider-css' /> <div class='es-sdk-content-column-css'> <s-text-view text='运行容器信息'></s-text-view> <s-text-view :text="'设备信息:' + deviceInfo"></s-text-view> <s-text-view :text="'设备类型:' + deviceType"></s-text-view> <s-text-view :text="'设备ID:' + deviceId"></s-text-view> </div> </div> </template> <script lang='ts'> import {defineComponent} from '@vue/runtime-core'; import {ref} from 'vue'; import {useESRuntime} from '@extscreen/es3-core'; export default defineComponent({ name: '运行时模块', setup() { const deviceType = ref(''); const deviceId = ref(''); const deviceInfo = ref(''); const runtimeDevice = useESRuntime(); runtimeDevice.init().then(); function onESCreate(params) { deviceInfo.value = JSON.stringify(runtimeDevice.getRuntimeDeviceInfo()); deviceId.value = runtimeDevice.getRuntimeDeviceId(); deviceType.value = runtimeDevice.getRuntimeDeviceType(); } return { onESCreate, deviceType, deviceId, deviceInfo, }; }, }); </script> <style> </style>