Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
78eb86a2
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看板
提交
78eb86a2
编写于
12月 18, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 兼容 web 端
上级
9ac47ff1
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
80 addition
and
92 deletion
+80
-92
pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue
...t-element-by-id/get-element-by-id-multiple-root-node.uvue
+46
-51
pages/API/get-element-by-id/get-element-by-id.uvue
pages/API/get-element-by-id/get-element-by-id.uvue
+31
-33
pages/API/navigator/new-page/onLoad.test.js
pages/API/navigator/new-page/onLoad.test.js
+3
-2
pages/tabBar/API.uvue
pages/tabBar/API.uvue
+0
-6
未找到文件。
pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue
浏览文件 @
78eb86a2
<template>
<template>
<view class="uni-padding-wrap">
<view class="uni-padding-wrap">
<page-head
<page-head id="page-head" title="getElementById-multiple-root-node"></page-head>
id="page-head"
title="getElementById-multiple-root-node"
></page-head>
<text id="text">this is text</text>
<text id="text">this is text</text>
<view id="view" class="uni-common-mt" style="border: 1px solid red"
<view id="view" class="uni-common-mt" style="border: 1px solid red">this is view</view>
>this is view</view
>
<button class="uni-btn" @click="changePageHeadBackgroundColor">
<button class="uni-btn" @click="changePageHeadBackgroundColor">
修改 page-head 背景色
修改 page-head 背景色
</button>
</button>
...
@@ -19,7 +14,7 @@
...
@@ -19,7 +14,7 @@
</template>
</template>
<script lang="uts">
<script lang="uts">
export default {
export default {
data() {
data() {
return {
return {
checked: false,
checked: false,
...
@@ -28,25 +23,25 @@ export default {
...
@@ -28,25 +23,25 @@ export default {
}
}
},
},
methods: {
methods: {
getElementByNotExistId(): Element | null {
getElementByNotExistId() : Element | null {
return uni.getElementById('not-exist-id')
return uni.getElementById('not-exist-id')
},
},
changePageHeadBackgroundColor(){
changePageHeadBackgroundColor() {
const pageHead = uni.getElementById('page-head')!
const pageHead = uni.getElementById('page-head')!
pageHead.style.setProperty('backgroundColor', 'red')
pageHead.style['backgroundColor'] = 'red'
},
},
changeTextColor(){
changeTextColor() {
const text = uni.getElementById('text')!
const text = uni.getElementById('text')!
text.style.setProperty('color', 'red')
text.style['color'] = 'red'
},
},
changeViewStyle(){
changeViewStyle() {
const view = uni.getElementById<UniViewElement>('view')
const view = uni.getElementById<UniViewElement>('view')
if(view !== null){
if (view !== null) {
view.style.setProperty('width', '90%')
view.style['width'] = '90%'
view.style.setProperty('height', '50px')
view.style['height'] = '50px'
view.style.setProperty('backgroundColor', '#007AFF')
view.style['backgroundColor'] = '#007AFF'
}
}
}
}
}
}
}
}
</script>
</script>
pages/API/get-element-by-id/get-element-by-id.uvue
浏览文件 @
78eb86a2
...
@@ -3,9 +3,7 @@
...
@@ -3,9 +3,7 @@
<page-head id="page-head" title="getElementById"></page-head>
<page-head id="page-head" title="getElementById"></page-head>
<view class="uni-padding-wrap">
<view class="uni-padding-wrap">
<text id="text">this is text</text>
<text id="text">this is text</text>
<view id="view" class="uni-common-mt" style="border: 1px solid red"
<view id="view" class="uni-common-mt" style="border: 1px solid red">this is view</view>
>this is view</view
>
<button class="uni-btn" @click="changePageHeadBackgroundColor">
<button class="uni-btn" @click="changePageHeadBackgroundColor">
修改 page-head 背景色
修改 page-head 背景色
</button>
</button>
...
@@ -23,7 +21,7 @@
...
@@ -23,7 +21,7 @@
</template>
</template>
<script lang="uts">
<script lang="uts">
export default {
export default {
data() {
data() {
return {
return {
checked: false,
checked: false,
...
@@ -37,23 +35,23 @@ export default {
...
@@ -37,23 +35,23 @@ export default {
},
},
changePageHeadBackgroundColor() {
changePageHeadBackgroundColor() {
const pageHead = uni.getElementById('page-head')!
const pageHead = uni.getElementById('page-head')!
pageHead.style.setProperty('backgroundColor', 'red')
pageHead.style['backgroundColor'] = 'red'
},
},
changeTextColor() {
changeTextColor() {
const text = uni.getElementById('text')!
const text = uni.getElementById('text')!
text.style.setProperty('color', 'red')
text.style['color'] = 'red'
},
},
changeViewStyle() {
changeViewStyle() {
const view = uni.getElementById<UniViewElement>('view')
const view = uni.getElementById<UniViewElement>('view')
if (view !== null) {
if (view !== null) {
view.style.setProperty('width', '90%')
view.style['width'] = '90%'
view.style.setProperty('height', '50px')
view.style['height'] = '50px'
view.style.setProperty('backgroundColor', '#007AFF')
view.style['backgroundColor'] = '#007AFF'
}
}
},
},
goMultipleRootNode() {
goMultipleRootNode() {
uni.navigateTo({ url: '/pages/API/get-element-by-id/get-element-by-id-multiple-root-node' })
uni.navigateTo({ url: '/pages/API/get-element-by-id/get-element-by-id-multiple-root-node' })
}
}
}
}
}
}
</script>
</script>
pages/API/navigator/new-page/onLoad.test.js
浏览文件 @
78eb86a2
...
@@ -72,7 +72,7 @@ describe("onLoad", () => {
...
@@ -72,7 +72,7 @@ describe("onLoad", () => {
failureThreshold
:
0.05
,
failureThreshold
:
0.05
,
failureThresholdType
:
"
percent
"
,
failureThresholdType
:
"
percent
"
,
});
});
await
p
age
.
waitFor
(
"
view
"
);
await
p
rogram
.
callUniMethod
(
'
hideToast
'
)
});
});
it
(
"
showLoading
"
,
async
()
=>
{
it
(
"
showLoading
"
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
...
@@ -91,6 +91,7 @@ describe("onLoad", () => {
...
@@ -91,6 +91,7 @@ describe("onLoad", () => {
failureThreshold
:
0.05
,
failureThreshold
:
0.05
,
failureThresholdType
:
"
percent
"
,
failureThresholdType
:
"
percent
"
,
});
});
await
program
.
callUniMethod
(
'
hideLoading
'
)
});
});
it
(
"
showModal
"
,
async
()
=>
{
it
(
"
showModal
"
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
...
...
pages/tabBar/API.uvue
浏览文件 @
78eb86a2
...
@@ -154,12 +154,6 @@
...
@@ -154,12 +154,6 @@
name: 'element元素',
name: 'element元素',
url: 'get-element-by-id',
url: 'get-element-by-id',
api: ["getElementById"],
api: ["getElementById"],
// #ifdef APP-ANDROID
enable: true,
// #endif
// #ifndef APP-ANDROID
enable: false,
// #endif
},
},
{
{
name: 'element draw',
name: 'element draw',
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录