# uni.getAppBaseInfo(options?)

获取app基本信息

# 参数

名称 类型 必填 默认值 描述
options GetAppBaseInfoOptions 包含所有字段的过滤对象 [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
名称 类型 必备 默认值 描述
filter Array<string> - 过滤字段的字符串数组,假如要获取指定字段,传入此数组。

# 返回值

类型
GetAppBaseInfoResult
名称 类型 必备 默认值 描述
appId string - manifest.json 中应用appid,即DCloud appid。
appName string - manifest.json 中应用名称。
appVersion string - manifest.json 中应用版本名称。
appVersionCode string - manifest.json 中应用版本名号。
appLanguage string - 应用设置的语言en、zh-Hans、zh-Hant、fr、es
language string - 应用设置的语言
version string - 引擎版本号。已废弃,仅为了向下兼容保留 已废弃,仅为了向下兼容保留
isUniAppX boolean - 是否uni-app x
uniCompileVersion string - uni 编译器版本 已废弃,仅为了向下兼容保留
uniCompilerVersion string - uni 编译器版本
uniPlatform "app" | "web" | "mp-weixin" | "mp-alipay" | "mp-baidu" | "mp-toutiao" | "mp-lark" | "mp-qq" | "mp-kuaishou" | "mp-jd" | "mp-360" | "quickapp-webview" | "quickapp-webview-union" | "quickapp-webview-huawei" - uni-app 运行平台。
uniRuntimeVersion string - uni 运行时版本
uniCompileVersionCode number - uni 编译器版本号 已废弃,仅为了向下兼容保留
uniCompilerVersionCode number - uni 编译器版本号
uniRuntimeVersionCode number - uni 运行时版本号
packageName string - Android的包名
bundleId string - iOS的bundleId
signature string - Android: 应用签名证书的SHA1值(全部为小写,中间不包含“:”)。 为了保证应用的安全性,请使用自己生成的证书(不要使用公共测试证书)。 iOS: 应用签名证书中绑定的Bundle ID(AppleID)的md5值(全部为小写)。
# GetAppBaseInfoResult 兼容性
Android iOS web
uniCompilerVersion 4.0 4.11 4.0
uniCompilerVersionCode 4.0 4.11 4.0
packageName 3.97 x x
bundleId x 4.11 x
signature 3.97 4.11 x

# getAppBaseInfo 兼容性

Android iOS web
3.9 4.11 4.0

# 参见

相关 Bug

# 示例

hello uni-app x

Template

Script

<template>
  <page-head :title="title"></page-head>
  <view class="uni-common-mt">
    <view class="uni-list">
      <view class="uni-list-cell" v-for="(item,_) in items" style="align-items: center;">
        <view class="uni-pd">
          <view class="uni-label" style="width:180px;">{{item.label}}</view>
        </view>
        <view class="uni-list-cell-db">
          <text style="width: 100%;">{{ item.value == '' ? '未获取' : item.value }}</text>
        </view>
      </view>
    </view>
    <view class="uni-padding-wrap">
      <view class="uni-btn-v">
        <button type="primary" @tap="getAppBaseInfo">获取App基础信息</button>
      </view>
    </view>
  </view>
</template>


<style>
	.uni-pd {
		padding-left: 15px;
	}
</style>

# 通用类型

# GeneralCallbackResult

名称 类型 必备 默认值 描述
errMsg string - 错误信息