应用列表模块
数据结构
ESAppInfo
应用信息
参数 | 描述 | 类型 | 非空 |
---|---|---|---|
name | 应用名称 | string | 是 |
pkg | 应用包名 | string | 是 |
verCode | 应用版本号 | number | 否 |
verName | 应用版本名称 | string | 否 |
installTime | 应用安装时间 | number | 否 |
updateTime | 应用更新时间 | number | 否 |
isSystemApp | 是否是系统应用 | boolean | 是 |
ESAppInfoList
应用列表
参数 | 描述 | 类型 | 非空 |
---|---|---|---|
system | 系统应用列表 | Array<ESAppInfo> | 否 |
user | 用户应用列表 | Array<ESAppInfo> | 否 |
接口
isAppInstalled
该方法根据应用包名判断应用是否安装。
完整方法声明:isAppInstalled(packageName: string): Promise<boolean>
- 参数:
参数 | 描述 | 类型 | 非空 |
---|---|---|---|
packageName | 应用的包名 | string | 是 |
- 返回值:
属性 | 描述 | 类型 | 默认值 |
---|---|---|---|
无 | 返回应用是否安装 | Promise<boolean> |
isSystemApp
该方法根据应用包名判断应用是否是系统应用。
完整方法声明:isSystemApp(packageName: string): Promise<boolean>
- 参数:
参数 | 描述 | 类型 | 非空 |
---|---|---|---|
packageName | 应用的包名 | string | 是 |
- 返回值:
属性 | 描述 | 类型 | 默认值 |
---|---|---|---|
无 | 返回应用是否是系统应用 | Promise<boolean> |
getAppList
该方法获取系统应用列表。
完整方法声明:getAppList(): Promise<ESAppInfoList>
- 参数:
无
- 返回值:
属性 | 描述 | 类型 | 默认值 |
---|---|---|---|
无 | 系统应用列表 | Promise<ESAppInfoList> |
getAutoStartAppList
该方法获取系统开机启动应用列表。
完整方法声明:getAutoStartAppList(): Promise<Array<ESAppInfo>>
- 参数:
无
- 返回值:
属性 | 描述 | 类型 | 默认值 |
---|---|---|---|
无 | 系统开机启动应用列表 | Promise<Array<ESAppInfo>> |
基础用法
- 代码示例:
点击查看源码
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-row-css'> <s-text-view text='----------------------系统应用----------------------'></s-text-view> <s-text-view v-for='(item, index) in systemAppList' :key='item' :text='JSON.stringify(item)'></s-text-view> <s-text-view text='----------------------用户应用----------------------'></s-text-view> <s-text-view v-for='(item, index) in userAppList' :key='item' :text='JSON.stringify(item)'></s-text-view> </div> </div> </template> <script lang='ts'> import {defineComponent} from '@vue/runtime-core'; import {ref} from 'vue'; import {useESAppList} from '@extscreen/es3-core'; export default defineComponent({ name: '应用列表模块', setup() { const appList = useESAppList(); const systemAppList = ref([]); const userAppList = ref([]); const onESCreate = (params) => { appList.getAppList().then( (appList) => { systemAppList.value = appList.system ?? []; userAppList.value = appList.user ?? []; }, error => { }); }; return { onESCreate, systemAppList, userAppList, }; }, }); </script> <style> </style>