提交 4b5ec577 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat: getApp

上级 bb7cbcab
...@@ -147,6 +147,12 @@ ...@@ -147,6 +147,12 @@
"backgroundColor": "#F8F8F8" "backgroundColor": "#F8F8F8"
} }
}, },
{
"path": "pages/API/get-app/get-app",
"style": {
"navigationBarTitleText": "getApp"
}
},
{ {
"path": "pages/API/navigator/navigator", "path": "pages/API/navigator/navigator",
"style": { "style": {
......
const PAGE_PATH = '/pages/API/get-app/get-app'
describe('getApp', () => {
it('getApp', async () => {
const page = await program.navigateTo(PAGE_PATH)
await page.waitFor(1000)
await page.callMethod('getApp')
const data = await page.data()
expect(data.checked).toBe(true)
})
})
<template>
<view>
<page-head title="getApp"></page-head>
<button @click="getApp">getApp</button>
</view>
</template>
<script>
export default {
data() {
return {
checked: false
}
},
methods: {
getApp: function () {
const app = getApp()
// TODO: JSON.stringify(app) 结果不符合预期,待客户端调整后修改逻辑
if (app != null) {
this.checked = true
}
}
}
}
</script>
<template> <template>
<view class="uni-padding-wrap"> <view class="uni-padding-wrap">
<page-head title="new-page-1" />
<text>onLoad 接收到参数</text> <text>onLoad 接收到参数</text>
<text>data: {{ data }}</text> <text>data: {{ data }}</text>
</view> </view>
......
<template> <template>
<view class="uni-padding-wrap container"> <view class="uni-padding-wrap container">
<page-head title="new-page-2" />
<button @click="pageScrollTo">scrollToBottom</button> <button @click="pageScrollTo">scrollToBottom</button>
</view> </view>
</template> </template>
......
...@@ -50,8 +50,7 @@ ...@@ -50,8 +50,7 @@
pages: [ pages: [
{ {
name: "getApp", name: "getApp",
url: "getApp", url: "get-app",
enable: false
}, },
{ {
name: "事件总线event-bus", name: "事件总线event-bus",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册