简体中文
uni-app x中,每个页面都对应一个UniPage对象。
如果是dialogPage,也可以通过UniPage的getDialogPage方法获取。
通过UniPage对象,可以获取/修改页面的pageStyle,让pages.json中的页面设置可以动态修改;可以继续获取原生页面对象,如原生view;可以继续获取页面的vue示例,通过vm属性。
UniPage在App和Web平台较完善,在小程序端受小程序未开放,很多功能无法实现。具体见兼容性表格。
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| route | string | 是 | - | 页面的路由地址 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| options | UTSJSONObject | 是 | - | 页面的路由参数信息 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vm | VueComponent | 否 | - | UniPage vue 实例对象 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pageBody | UniPageBody | 是 | - | UniPage 页面可使用区域信息,单位为px | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| safeAreaInsets | UniSafeAreaInsets | 是 | - | UniPage 安全区域插入位置(与屏幕边界的距离)信息 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fullscreenElement | UniElement | 否 | - | 已经进入全屏状态的元素 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| width | number | 是 | - | 页面窗口宽度 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| height | number | 是 | - | 页面窗口高度 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| statusBarHeight | number | 是 | - | 页面状态栏高度 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| VueComponent | 否 | - | UniPage vue 实例对象 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|
| - | x | - | - | - | - |
获取当前页面样式。详细属性配置请参考PageStyle
pages.json里的页面配置,即page下的style节点的内容,可以通过本API获取。但注意这里获取的是UniPage上的最终生效值,不是pages.json里的原始配置。
| Web | 微信小程序 | Android | iOS | iOS uni-app x UTS 插件 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| 4.31 | x | 4.31 | 4.31 | 4.31 | 4.61 | - |
| 类型 |
|---|
| UTSJSONObject |
设置当前页面样式。详细属性配置请参考PageStyle
pages.json里的内容是静态的,通过本API可以动态设置UniPage的Style,但并非所有页面样式都支持动态配置,具体见下PageStyle。
| Web | 微信小程序 | Android | iOS | iOS uni-app x UTS 插件 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| 4.31 | x | 4.31 | 4.31 | 4.31 | 4.61 | - |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| style | UTSJSONObject | 是 | - |
注意
选项式 API 时,不可创建 route、options 同名响应式变量,否则会覆盖当前 page 实例 的同名属性。Web 与 iOS(非 uts 插件) 端支持通过 page.$vm 获取 vue 实例。iOS uts 插件 环境不支持通过 page.vm 获取 vue 实例。PageStyle
支持当前页面 style 节点属性(注意并非所有 pages.json 的 pageStyle 都可以动态修改)
| 属性 | 类型 | Android | iOS | HarmonyOS | web | 默认值 |
|---|---|---|---|---|---|---|
| enablePullDownRefresh | Boolean | 4.13 | 4.13 | 4.61 | 4.13 | false |
| backgroundColorContent | String | 4.15 | 4.15 | 4.61 | 4.18 | #ffffff |
| navigationBarBackgroundColor | String | 4.18 | 4.18 | 4.61 | 4.18 | #007AFF |
| navigationBarTextStyle | String | 4.18 | 4.18 | 4.61 | 4.18 | white |
| navigationBarTitleText | String | 4.18 | 4.18 | 4.61 | 4.18 | "" |
| navigationStyle | String | x | x | 4.61 | 4.18 | default |
| backgroundColor | String | 4.18 | 4.18 | 4.61 | x | #ffffff |
| backgroundTextStyle | String | 4.31 | 4.31 | x | x | dark |
| onReachBottomDistance | Number | x | x | 4.61 | 4.18 | 50 |
| pageOrientation | String | 4.18 | 4.25 | x | x | auto |
| disableSwipeBack | Boolean | x | 4.18 | x | x | false |
| hideStatusBar | Boolean | 4.31 | x | x | x | false |
| hideBottomNavigationIndicator | Boolean | 4.31 | x | x | x | false |
注意事项
enablePullDownRefresh,那么下拉刷新功能会被摇掉,此时设置打开下拉刷新将无效。backgroundColorContent设为透明。enablePullDownRefresh 为 false 时,无法通过 $setPageStyle 方法动态开启页面下拉刷新。新版已修复该问题。用于 dialogPage 获取所属父页面
| Web | 微信小程序 | Android | iOS | iOS uni-app x UTS 插件 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| 4.31 | x | 4.31 | 4.31 | 4.31 | 4.61 | - |
| 类型 | 必备 |
|---|---|
| UniPage | 否 |
获取当前页面的 dialog 子页面集合
| Web | 微信小程序 | Android | iOS | iOS uni-app x UTS 插件 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| 4.31 | x | 4.31 | 4.31 | 4.31 | 4.61 | - |
| 类型 |
|---|
| Array<UniPage> |
返回一个匹配特定 ID 的元素, 如果不存在,返回 null。
如果需要获取指定的节点类型,需要使用 as 进行类型转换。
ID 区分大小写,且应该是唯一的。如果存在多个匹配的元素,则返回第一个匹配的元素。
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|
| 4.31 | x | 4.31 | 4.31 | 4.61 | - |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| id | string.IDString | string | 是 | - |
| 类型 | 必备 |
|---|---|
| UniElement | 否 |
返回 android 平台页面根 view
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|
| x | x | 4.31 | x | x | - |
| 类型 | 必备 |
|---|---|
| View | 否 |
返回 android 平台加载页面内容的Activity
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|
| x | x | 4.61 | x | x | - |
| 类型 | 必备 |
|---|---|
| Activity | 否 |
返回 ios 平台页面根 view
| Web | 微信小程序 | Android | iOS | iOS uni-app x UTS 插件 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| x | x | x | x | 4.33 | x | - |
| 类型 | 必备 |
|---|---|
| UIView | 否 |
返回页面 HTML Element 对象
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|
| 4.31 | x | x | x | x | - |
| 类型 | 必备 |
|---|---|
| UniElement | 否 |
将当前在全屏模式下显示的元素退出全屏模式,恢复全屏之前的状态
用于逆转先前调用 UniElement.requestFullscreen 的效果。
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|
| x | x | 4.61 | x | 4.61 | - |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | ExitFullscreenOptions | 否 | - | ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| errCode | number | 是 | - | 错误码 | |||||||||||||||||||
| |||||||||||||||||||||||
| errSubject | string | 是 | - | 统一错误主题(模块)名称 | |||||||||||||||||||
| data | any | 否 | - | 错误信息中包含的数据 | |||||||||||||||||||
| cause | Error | 否 | - | 源错误信息,可以包含多个错误,详见SourceError | |||||||||||||||||||
| errMsg | string | 是 | - | ||||||||||||||||||||
createElement
创建组件
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|
| x | x | x | x | 4.63 | x |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| tagName | string | 是 | - |
| 类型 |
|---|
| UniElement |
onLayoutChange
监听页面布局变化更新事件
| Web | 微信小程序 | Android | iOS | HarmonyOS 系统版本 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| - | x | x | x | 6.0 | x | 5.0 |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| callback | (res: UniPagePerformanceTiming) => void | 是 | - |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| duration | number | 是 | - | 性能计时持续的时间,单位为ms |
| 类型 |
|---|
| number |
offLayoutChange
取消监听页面布局变化更新事件
| Web | 微信小程序 | Android | iOS | HarmonyOS 系统版本 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| - | x | x | x | 6.0 | x | 5.0 |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| id | number | 是 | - |
onRenderChange
监听页面渲染变化更新事件
| Web | 微信小程序 | Android | iOS | HarmonyOS 系统版本 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| - | x | x | x | 6.0 | x | 5.0 |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| callback | (res: UniPagePerformanceRenderTiming) => void | 是 | - |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| updateDuration | number | 是 | - | 更新渲染属性的总时间,单位为ms | |
| duration | number | 是 | - | 性能计时持续的时间,单位为ms |
| 类型 |
|---|
| number |
offRenderChange
取消监听页面渲染变化更新事件
| Web | 微信小程序 | Android | iOS | HarmonyOS 系统版本 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| - | x | x | x | 6.0 | x | 5.0 |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| id | number | 是 | - |
onTouchStart
监听页面触摸开始事件
| Web | 微信小程序 | Android | iOS | HarmonyOS 系统版本 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| - | x | x | x | 6.0 | x | 5.0 |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| callback | (event: UniTouchEvent) => void | 是 | - |
| 类型 |
|---|
| number |
offTouchStart
取消监听页面触摸开始事件
| Web | 微信小程序 | Android | iOS | HarmonyOS 系统版本 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| - | x | x | x | 6.0 | x | 5.0 |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| id | number | 是 | - |
onTouchEnd
监听页面触摸结束事件
| Web | 微信小程序 | Android | iOS | HarmonyOS 系统版本 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| - | x | x | x | 6.0 | x | 5.0 |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| callback | (event: UniTouchEvent) => void | 是 | - |
| 类型 |
|---|
| number |
offTouchEnd
取消监听页面触摸结束事件
| Web | 微信小程序 | Android | iOS | HarmonyOS 系统版本 | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|---|
| - | x | x | x | 6.0 | x | 5.0 |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| id | number | 是 | - |
querySelector
返回页面中与指定选择器或选择器组匹配的第一个 Element对象。如果找不到匹配项,则返回null
| Web | 微信小程序 | Android | iOS | iOS uni-app x UTS 插件 | HarmonyOS | HarmonyOS(Vapor) | HarmonyOS uni-app x UTS 插件 |
|---|---|---|---|---|---|---|---|
| x | x | x | x | x | x | - | x |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| selector | string.cssSelectorString | 是 | - | CSS 选择器字符串 |
| 类型 | 必备 |
|---|---|
| UniElement | 否 |
querySelectorAll
返回页面中与指定选择器或选择器组匹配的元素列表。
| Web | 微信小程序 | Android | iOS | iOS uni-app x UTS 插件 | HarmonyOS | HarmonyOS(Vapor) | HarmonyOS uni-app x UTS 插件 |
|---|---|---|---|---|---|---|---|
| x | x | x | x | x | x | - | x |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| selector | string.cssSelectorString | 是 | - | CSS 选择器字符串 |
| 类型 |
|---|
| Array<UniElement> |
设置当前页面样式。详细属性配置请参考PageStyle 已废弃,仅为了向下兼容保留
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|
| 4.13 | x | 4.13 | 4.13 | 4.61 | - |
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|---|
| style | UTSJSONObject | 是 | - |
获取当前页面样式。详细属性配置请参考PageStyle 已废弃,仅为了向下兼容保留
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|
| 4.13 | x | 4.13 | 4.13 | 4.61 | - |
| 类型 |
|---|
| UTSJSONObject |
示例为hello uni-app x alpha分支,与最新HBuilderX Alpha版同步。与最新正式版同步的master分支示例另见
示例
<template>
<!-- #ifdef APP -->
<scroll-view class="page-scroll-view">
<!-- #endif -->
<view>
<page-head title="getCurrentPages"></page-head>
<view class="uni-padding-wrap">
<button @click="_getCurrentPages">getCurrentPages</button>
<view v-if="pages.length" style="padding: 15px 0px">
<text>当前页面栈中 {{ pages.length }} 个页面,列表如下:</text>
<template v-for="(page, index) in pages" :key="page.route">
<text style="margin-top: 5px">index: {{ index }}, route: {{ page.route }}</text>
</template>
</view>
<!-- #ifndef MP -->
<button class="uni-common-mt" @click="check$page">check $page</button>
<button class="uni-common-mt" @click="checkGetParentPage">
check getParentPage
</button>
<button class="uni-common-mt" @click="checkGetDialogPages">
check getDialogPages
</button>
<button id="check-get-element-by-id-btn" class="uni-common-mt" @click="checkGetElementById">
check getElementById
</button>
<button class="uni-common-mt" @click="checkGetAndroidView">
check getAndroidView
</button>
<button class="uni-common-mt" @click="checkGetIOSView">
check getIOSView
</button>
<button class="uni-common-mt" @click="checkGetHTMLElement">
check getHTMLElement
</button>
<!-- #endif -->
<!-- #ifdef APP-ANDROID -->
<button class="uni-common-mt" @click="checkGetAndroidActivity">
check getAndroidActivity
</button>
<!-- #endif -->
</view>
<!-- #ifndef MP -->
<page-head title="currentPageStyle"></page-head>
<template v-for="(item, index) in PageStyleArray">
<view class="page-style-item" v-if="currentPageStyle[item.key] != null" :key="index">
<view class="item-text">
<text class="item-text-key">{{ item.key }}:</text>
<text class="item-text-value">{{
currentPageStyle[item.key]
}}</text>
</view>
<view class="set-value" v-if="item.type == 'boolean'">
<switch :checked="currentPageStyle.getBoolean(item.key)"
@change="switchChange(item.key, $event as UniSwitchChangeEvent)">
</switch>
</view>
<view class="set-value" v-else-if="item.type == 'number'">
<slider :value="currentPageStyle.getNumber(item.key)" :show-value="true"
@change="sliderChange(item.key, $event as UniSliderChangeEvent)" />
</view>
<view class="set-value" v-else-if="item.type == 'string'">
<radio-group class="radio-set-value" @change="radioChange(item.key, $event as RadioGroupChangeEvent)">
<radio class="radio-value" v-for="(item2, index2) in item.value" :key="index2" :value="item2">{{ item2 }}
</radio>
</radio-group>
</view>
</view>
</template>
<!-- #ifndef APP-HARMONY -->
<button style="margin: 10px" @click="goSetDisablePullDownRefresh">
go set disable pullDownRefresh
</button>
<!-- #endif -->
<!-- #endif -->
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
import { PageStyleItem, PageStyleArray } from './page-style.uts';
class Page {
constructor(public route : string) {
}
}
export default {
data() {
return {
checked: false,
pages: [] as Page[],
PageStyleArray: PageStyleArray as PageStyleItem[],
currentPageStyle: {} as UTSJSONObject,
testing: false
}
},
computed: {
pageStyleText() : string {
return JSON.stringify(this.currentPageStyle)
}
},
// #ifndef MP
onLoad() {
this.getPageStyle();
},
// #endif
onReady() {
// #ifdef APP-ANDROID
this.setPageStyle({
'androidThreeButtonNavigationBackgroundColor': 'transparent',
'androidThreeButtonNavigationStyle': 'black'
});
this.getPageStyle();
// #endif
},
onPullDownRefresh() {
setTimeout(() => {
uni.stopPullDownRefresh()
}, 2000)
},
methods: {
startPullDownRefresh() {
uni.startPullDownRefresh()
},
_getCurrentPages: function () {
this.pages.length = 0
const pages = getCurrentPages()
this.pages.push(new Page(pages[0].route))
if (this.pages[0].route.includes('/tabBar/') || this.pages[0].route == '/') {
this.checked = true
}
for (let i = 1; i < pages.length; i++) {
this.pages.push(new Page(pages[i].route))
if (pages[i].route.includes('/tabBar/')) {
this.checked = false
}
}
},
/// get-set-page-style
radioChange(key : string, e : RadioGroupChangeEvent) {
this.setStyleValue(key, e.detail.value);
},
sliderChange(key : string, e : UniSliderChangeEvent) {
this.setStyleValue(key, e.detail.value);
},
switchChange(key : string, e : UniSwitchChangeEvent) {
this.setStyleValue(key, e.detail.value);
},
setStyleValue(key : string, value : any) {
const style = {}
style[key] = value
this.setPageStyle(style)
this.getPageStyle()
},
getPageStyle() : UTSJSONObject {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
this.currentPageStyle = currentPage.getPageStyle()
console.log(this.currentPageStyle)
return this.currentPageStyle;
},
setPageStyle(style : UTSJSONObject) {
console.log('setPageStyle:', style);
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
currentPage.setPageStyle(style);
},
goSetDisablePullDownRefresh() {
uni.navigateTo({
url: '/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh'
});
},
getCurrentPage() : UniPage {
const pages = getCurrentPages()
return pages[pages.length - 1]
},
check$page() : boolean {
const page = this.getCurrentPage()
let res = this.$page === page
if (this.testing && res) {
res = page.options['test'] == '123'
if (res) {
res = page.route == 'pages/API/get-current-pages/get-current-pages'
}
}
console.log('check $page', res)
uni.showToast(res ? { title: 'check success' } : { title: 'check fail', icon: 'error' })
return res
},
checkGetParentPage() : boolean {
const page = this.getCurrentPage()
const parentPage = page.getParentPage()
const res = parentPage == null
console.log('check getParentPage', res)
uni.showToast(res ? { title: 'check success' } : { title: 'check fail', icon: 'error' })
return res
},
checkGetDialogPages() : boolean {
const page = this.getCurrentPage()
const dialogPages = page.getDialogPages()
const res = Array.isArray(dialogPages) && dialogPages.length == 0
uni.showToast(res ? { title: 'check success' } : { title: 'check fail', icon: 'error' })
console.log('check getDialogPages', res)
return res
},
checkGetElementById() : boolean {
const page = this.getCurrentPage()
const element = page.getElementById('check-get-element-by-id-btn')
let res = element != null
// #ifndef APP-ANDROID
if (res) {
const elPage = element!.getPage()
console.log('elPage', elPage)
res = elPage === page
}
// #endif
console.log('check getElementById', res)
uni.showToast(res ? { title: 'check success' } : { title: 'check fail', icon: 'error' })
return res
},
checkGetAndroidView() : boolean {
const page = this.getCurrentPage()
const androidView = page.getAndroidView()
const res = androidView != null
console.log('check getAndroidView', res)
uni.showToast(res ? { title: 'check success' } : { title: 'check fail', icon: 'error' })
return res
},
checkGetIOSView() : boolean {
const page = this.getCurrentPage()
const IOSView = page.getIOSView()
const res = IOSView != null
console.log('check getIOSView', res)
uni.showToast(res ? { title: 'check success' } : { title: '仅 IOS uts 插件环境支持', icon: 'error' })
return res
},
checkGetHTMLElement() : boolean {
const page = this.getCurrentPage()
const HTMLView = page.getHTMLElement()
const res = HTMLView != null
console.log('check getHTMLElement', res)
uni.showToast(res ? { title: 'check success' } : { title: 'check fail', icon: 'error' })
return res
},
checkGetAndroidActivity() : boolean {
const page = this.getCurrentPage()
const activity = page.getAndroidActivity()
const res = activity != null
console.log('check getAndroidActivity', res)
uni.showToast(res ? { title: 'check success' } : { title: 'check getAndroidActivity', icon: 'error' })
return res
}
},
}
</script>
<style>
.page {
flex: 1;
padding: 10px;
}
.page-style {
margin-top: 15px;
}
.page-style-item {
padding: 10px;
margin-top: 10px;
background-color: #ffffff;
border-radius: 5px;
}
.item-text {
flex-direction: row;
}
.item-text-key {
font-weight: bold;
}
.item-text-value {
margin-left: 5px;
}
.set-value {
margin-top: 10px;
}
.radio-set-value {
flex-direction: row;
}
.radio-value {
margin-left: 10px;
}
</style>