Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
db9eea53
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
db9eea53
编写于
11月 21, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 处理小程序兼容问题
上级
70b54085
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
27 addition
and
13 deletion
+27
-13
pages/API/choose-location/choose-location.test.js
pages/API/choose-location/choose-location.test.js
+3
-3
pages/API/dialog-page/dialog-page.test.js
pages/API/dialog-page/dialog-page.test.js
+8
-1
pages/API/get-app/get-app.test.js
pages/API/get-app/get-app.test.js
+8
-5
pages/API/get-app/get-app.uvue
pages/API/get-app/get-app.uvue
+6
-2
pages/API/get-current-pages/get-current-pages.uvue
pages/API/get-current-pages/get-current-pages.uvue
+2
-2
未找到文件。
pages/API/choose-location/choose-location.test.js
浏览文件 @
db9eea53
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
isWeixin
=
platformInfo
==
'
mp-weixin
'
const
isMP
=
platformInfo
.
startsWith
(
'
mp
'
)
describe
(
'
dialog page
'
,
()
=>
{
describe
(
'
dialog page
'
,
()
=>
{
if
(
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
==
'
true
'
)
{
if
(
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
==
'
true
'
)
{
...
@@ -8,8 +8,8 @@ describe('dialog page', () => {
...
@@ -8,8 +8,8 @@ describe('dialog page', () => {
})
})
return
return
}
}
if
(
is
Weixin
)
{
if
(
is
MP
)
{
it
(
'
skip
app-webview
'
,
()
=>
{
it
(
'
skip
mp
'
,
()
=>
{
expect
(
1
).
toBe
(
1
)
expect
(
1
).
toBe
(
1
)
})
})
return
return
...
...
pages/API/dialog-page/dialog-page.test.js
浏览文件 @
db9eea53
...
@@ -3,6 +3,7 @@ jest.setTimeout(20000)
...
@@ -3,6 +3,7 @@ jest.setTimeout(20000)
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
const
isAndroid
=
platformInfo
.
startsWith
(
'
android
'
)
const
isAndroid
=
platformInfo
.
startsWith
(
'
android
'
)
const
isMP
=
platformInfo
.
startsWith
(
'
mp
'
)
const
FIRST_PAGE_PATH
=
'
/pages/API/dialog-page/dialog-page
'
const
FIRST_PAGE_PATH
=
'
/pages/API/dialog-page/dialog-page
'
const
NEXT_PAGE_PATH
=
'
/pages/API/dialog-page/next-page
'
const
NEXT_PAGE_PATH
=
'
/pages/API/dialog-page/next-page
'
...
@@ -13,6 +14,12 @@ describe('dialog page', () => {
...
@@ -13,6 +14,12 @@ describe('dialog page', () => {
})
})
return
return
}
}
if
(
isMP
)
{
it
(
'
skip mp
'
,
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
let
page
;
let
page
;
let
initLifeCycleNum
;
let
initLifeCycleNum
;
...
...
pages/API/get-app/get-app.test.js
浏览文件 @
db9eea53
const
PAGE_PATH
=
'
/pages/API/get-app/get-app
'
const
PAGE_PATH
=
'
/pages/API/get-app/get-app
'
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isAndroid
=
platformInfo
.
startsWith
(
'
android
'
)
const
isAndroid
=
platformInfo
.
startsWith
(
'
android
'
)
const
isMP
=
platformInfo
.
startsWith
(
'
mp
'
)
describe
(
'
getApp
'
,
()
=>
{
describe
(
'
getApp
'
,
()
=>
{
let
page
=
null
let
page
=
null
...
@@ -49,8 +50,10 @@ describe('getApp', () => {
...
@@ -49,8 +50,10 @@ describe('getApp', () => {
expect
(
newLifeCycleNum
-
oldLifeCycleNum
).
toBe
(
100
)
expect
(
newLifeCycleNum
-
oldLifeCycleNum
).
toBe
(
100
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
oldLifeCycleNum
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
oldLifeCycleNum
)
})
})
if
(
!
isMP
)
{
it
(
'
getAndroidApplication
'
,
async
()
=>
{
it
(
'
getAndroidApplication
'
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
getAndroidApplication
'
)
const
res
=
await
page
.
callMethod
(
'
getAndroidApplication
'
)
expect
(
res
).
toBe
(
isAndroid
)
expect
(
res
).
toBe
(
isAndroid
)
})
})
}
})
})
pages/API/get-app/get-app.uvue
浏览文件 @
db9eea53
...
@@ -39,10 +39,12 @@
...
@@ -39,10 +39,12 @@
increase lifeCycleNum
increase lifeCycleNum
</button>
</button>
<text class="uni-common-mt">lifeCycleNum: {{ lifeCycleNum }}</text>
<text class="uni-common-mt">lifeCycleNum: {{ lifeCycleNum }}</text>
<!-- #ifndef MP -->
<button class="uni-common-mt" @click="getAndroidApplication">
<button class="uni-common-mt" @click="getAndroidApplication">
getAndroidApplication
getAndroidApplication
</button>
</button>
<text class="uni-common-mt">androidApplication is null: {{ androidApplication == null }}</text>
<text class="uni-common-mt">androidApplication is null: {{ androidApplication == null }}</text>
<!-- #endif -->
</view>
</view>
</view>
</view>
<!-- #ifdef APP -->
<!-- #ifdef APP -->
...
@@ -173,11 +175,13 @@
...
@@ -173,11 +175,13 @@
setLifeCycleNum(num : number) {
setLifeCycleNum(num : number) {
setLifeCycleNum(num)
setLifeCycleNum(num)
},
},
// #ifndef MP
getAndroidApplication() : boolean {
getAndroidApplication() : boolean {
const app = getApp()
const app = getApp()
this.androidApplication = app.getAndroidApplication()
this.androidApplication = app.getAndroidApplication()
return this.androidApplication !== null
return this.androidApplication !== null
}
}
// #endif
},
},
}
}
</script>
</script>
...
...
pages/API/get-current-pages/get-current-pages.uvue
浏览文件 @
db9eea53
...
@@ -93,12 +93,12 @@
...
@@ -93,12 +93,12 @@
}
}
},
},
onLoad(options : OnLoadOptions) {
onLoad(options : OnLoadOptions) {
// #if
ndef APP-ANDROID
// #if
def APP-IOS || WEB
if (options instanceof UTSJSONObject) {
if (options instanceof UTSJSONObject) {
this.checked = true
this.checked = true
}
}
// #endif
// #endif
// #if
def APP-ANDROID
// #if
ndef APP-IOS || WEB
this.checked = true
this.checked = true
// #endif
// #endif
this.getPageStyle();
this.getPageStyle();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录