Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Accustomed_
hello uni-app x
提交
e9385585
H
hello uni-app x
项目概览
Accustomed_
/
hello uni-app x
与 Fork 源项目一致
Fork自
DCloud / hello uni-app x
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e9385585
编写于
11月 01, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: setNavigationBarTitle
上级
a4737498
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
89 addition
and
9 deletion
+89
-9
pages.json
pages.json
+12
-6
pages/API/set-navigation-bar-title/set-navigation-bar-title.test.js
...set-navigation-bar-title/set-navigation-bar-title.test.js
+26
-0
pages/API/set-navigation-bar-title/set-navigation-bar-title.uvue
...PI/set-navigation-bar-title/set-navigation-bar-title.uvue
+49
-0
pages/tabBar/API.uvue
pages/tabBar/API.uvue
+2
-3
未找到文件。
pages.json
浏览文件 @
e9385585
...
@@ -257,11 +257,17 @@
...
@@ -257,11 +257,17 @@
"navigationBarTitleText"
:
"页面跳转"
"navigationBarTitleText"
:
"页面跳转"
}
}
},
},
{
{
"path"
:
"pages/API/set-navigation-bar-color/set-navigation-bar-color"
,
"path"
:
"pages/API/set-navigation-bar-color/set-navigation-bar-color"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"设置导航条颜色"
"navigationBarTitleText"
:
"设置导航条颜色"
}
}
},
{
"path"
:
"pages/API/set-navigation-bar-title/set-navigation-bar-title"
,
"style"
:
{
"navigationBarTitleText"
:
"设置导航条标题"
}
},
},
{
{
"path"
:
"pages/API/set-navigation-bar-color/set-custom-navigation-bar-color"
,
"path"
:
"pages/API/set-navigation-bar-color/set-custom-navigation-bar-color"
,
...
@@ -1018,7 +1024,7 @@
...
@@ -1018,7 +1024,7 @@
},
},
{
{
"path"
:
"pages/API/install-apk/install-apk"
,
"path"
:
"pages/API/install-apk/install-apk"
,
"style"
:
"style"
:
{
{
"navigationBarTitleText"
:
"install-apk"
,
"navigationBarTitleText"
:
"install-apk"
,
"enablePullDownRefresh"
:
false
"enablePullDownRefresh"
:
false
...
...
pages/API/set-navigation-bar-title/set-navigation-bar-title.test.js
0 → 100644
浏览文件 @
e9385585
const
CURRENT_PAGE_PATH
=
"
/pages/API/set-navigation-bar-title/set-navigation-bar-title
"
;
describe
(
"
setNavigationBarColor
"
,
()
=>
{
let
page
;
let
originLifeCycleNum
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
CURRENT_PAGE_PATH
);
await
page
.
waitFor
(
1000
);
originLifeCycleNum
=
await
page
.
callMethod
(
"
getLifeCycleNum
"
);
});
afterAll
(
async
()
=>
{
await
page
.
callMethod
(
"
setLifeCycleNum
"
,
originLifeCycleNum
);
const
lifeCycleNum
=
await
page
.
callMethod
(
"
getLifeCycleNum
"
);
expect
(
lifeCycleNum
).
toBe
(
originLifeCycleNum
);
});
it
(
"
setNavigationBarTitle
"
,
async
()
=>
{
await
page
.
callMethod
(
"
setNavigationBarTitle
"
);
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
const
lifeCycleNum
=
await
page
.
callMethod
(
"
getLifeCycleNum
"
);
expect
(
lifeCycleNum
-
originLifeCycleNum
).
toBe
(
2
);
});
});
pages/API/set-navigation-bar-title/set-navigation-bar-title.uvue
0 → 100644
浏览文件 @
e9385585
<template>
<view>
<page-head title="setNavigationBarTitle"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="setNavigationBarTitle" class="uni-btn">
设置当前页面的标题为 {{ newTitle }}
</button>
</view>
</view>
</template>
<script lang="uts">
import { state, setLifeCycleNum } from '@/store/index.uts'
export default {
data(){
return {
newTitle: 'new title'
}
},
methods: {
setNavigationBarTitle() {
uni.setNavigationBarTitle({
title: this.newTitle,
success() {
console.log('setNavigationBarTitle success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
fail() {
console.log('setNavigationBarTitle success')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
complete() {
console.log('setNavigationBarTitle complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
})
},
// 自动化测试
getLifeCycleNum(): number {
return state.lifeCycleNum
},
// 自动化测试
setLifeCycleNum(num: number) {
setLifeCycleNum(num)
}
},
}
</script>
pages/tabBar/API.uvue
浏览文件 @
e9385585
...
@@ -97,12 +97,11 @@
...
@@ -97,12 +97,11 @@
url: 'navigator',
url: 'navigator',
api: ["navigateTo", "reLaunch", "navigateBack", "redirectTo", "switchTab"]
api: ["navigateTo", "reLaunch", "navigateBack", "redirectTo", "switchTab"]
},
},
/*
{
{
name: '设置导航条标题',
name: '设置导航条标题',
url: 'set-navigation-bar-title',
url: 'set-navigation-bar-title',
enable: false,
},
}, */
{
{
name: '设置导航条颜色',
name: '设置导航条颜色',
url: 'set-navigation-bar-color',
url: 'set-navigation-bar-color',
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录