# uni.getAppBaseInfo(options?)

获取app基本信息

# # Parameters

name type required default description
options GetAppBaseInfoOptions NO 包含所有字段的过滤对象 [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。

# # GetAppBaseInfoOptions Values

name type optinal default description
filter Array<string> YES - 过滤字段的字符串数组,假如要获取指定字段,传入此数组。

# # Return value

Type
GetAppBaseInfoResult

# # GetAppBaseInfoResult Values

name type optinal default description
appId string NO - manifest.json 中应用appid,即DCloud appid。
appName string NO - manifest.json 中应用名称。
appVersion string NO - manifest.json 中应用版本名称。
appVersionCode string NO - manifest.json 中应用版本名号。
appLanguage string NO - 应用设置的语言en、zh-Hans、zh-Hant、fr、es
language string NO - 应用设置的语言
version string NO - 引擎版本号。已废弃,仅为了向下兼容保留
isUniAppX boolean NO - 是否uni-app x
uniCompileVersion string NO - uni 编译器版本
uniPlatform string NO - uni-app 运行平台。如:appmp-weixinweb
uniRuntimeVersion string NO - uni 运行时版本
uniCompileVersionCode number NO - uni 编译器版本号
uniRuntimeVersionCode number NO - uni 运行时版本号
packageName string NO - Android的包名
signature string NO - Android: 应用签名证书的SHA1值(全部为小写,中间不包含“:”)。 为了保证应用的安全性,请使用自己生成的证书(不要使用公共测试证书)。 iOS: 应用签名证书中绑定的Bundle ID(AppleID)的md5值(全部为小写)。
# # GetAppBaseInfoResult Compatibility
Android version Android uni-app Android uni-app-x iOS version iOS uni-app iOS uni-app-x
packageName 4.4 x 3.97 x x x
signature 4.4 x 3.97 9.0 x 3.97

# # getAppBaseInfo Compatibility

Android version Android uni-app Android uni-app-x iOS version iOS uni-app iOS uni-app-x
4.4 3.9+ 9.0 3.9+

# # See also

getAppBaseInfo

Related Bug

# # Example

hello uni-app x

<template>
   <view>
   	<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">
   					<textarea :auto-height="true" :disabled="true" placeholder="未获取" :value="item.value" />
   				</view>
   			</view>
   		</view>
   		<view class="uni-padding-wrap">
   			<view class="uni-btn-v">
   				<button type="primary" @tap="getAppBaseInfo">获取App基础信息</button>
   			</view>
   		</view>
   	</view>
   </view>
</template>
<script>
   type Item = {
   	label : string,
   	value : string,
   }
   export default {
   	data() {
   		return {
   			title: 'getAppBaseInfo',
   			items: [] as Item[],
   		}
   	},
   	onUnload:function(){
   	},
   	methods: {
   		getAppBaseInfo: function () {
   			const res = uni.getAppBaseInfo();
       this.items = [] as Item[];
       for(const key in res){
         const value = res[key];
         if(value != null){
           const item = {
           	label: key,
           	value: "" + ((typeof value == "object")? JSON.stringify(value) : value)
           } as Item;
           this.items.push(item);
         }
       }
   		}
   	}
   }
</script>

<style>
   .uni-pd {
   	padding-left: 30rpx;
   }
</style>

# # General type

# # GeneralCallbackResult

name type optinal default description
errMsg string YES - 错误信息