Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
afdeb884
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5994
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看板
提交
afdeb884
编写于
9月 14, 2023
作者:
M
mehaotian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 自定义导航栏组件
上级
736c67ef
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
286 addition
and
0 deletion
+286
-0
components/uni-tabbar-light/uni-icons.css
components/uni-tabbar-light/uni-icons.css
+17
-0
components/uni-tabbar-light/uni-tabbar-light.uvue
components/uni-tabbar-light/uni-tabbar-light.uvue
+110
-0
components/uni-tabbar-light/uni-tabbar-light.vue
components/uni-tabbar-light/uni-tabbar-light.vue
+94
-0
components/uni-tabbar-light/uniicons.ttf
components/uni-tabbar-light/uniicons.ttf
+0
-0
pages.json
pages.json
+9
-0
pages/tabBar/template.uvue
pages/tabBar/template.uvue
+7
-0
pages/template/navbar-light/navbar-light.uvue
pages/template/navbar-light/navbar-light.uvue
+49
-0
未找到文件。
components/uni-tabbar-light/uni-icons.css
0 → 100644
浏览文件 @
afdeb884
@font-face
{
font-family
:
"UniIconsLight"
;
src
:
url('./uniicons.ttf')
format
(
'truetype'
);
}
.uni-icons
{
font-family
:
"iconfont"
!important
;
font-size
:
16px
;
font-style
:
normal
;
-webkit-font-smoothing
:
antialiased
;
-moz-osx-font-smoothing
:
grayscale
;
}
.uniui-back
:before
{
content
:
"\e600"
;
}
components/uni-tabbar-light/uni-tabbar-light.uvue
0 → 100644
浏览文件 @
afdeb884
<template>
<view class="uni-navbar">
<view class="uni-navbar-inner" :style="navbarStyle">
<view class="left-content" @click="back">
<text class="uni-icons">{{unicode}}</text>
</view>
<view class="uni-navbar-content">
<slot>{{title}}</slot>
</view>
<view class="right-content">
<slot name="right"></slot>
</view>
</view>
</view>
</template>
<script>
import iconpath from './uniicons.ttf'
export default {
name: "uni-navbar",
props: {
title: {
type: String,
default: ''
},
open: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
statusBarHeight: 0
};
},
computed: {
navbarStyle() : string {
return `margin-top:${this.statusBarHeight}px`
},
unicode() : string {
return '\ue600'
}
},
created() {
uni.loadFontFace({
global: false,
family: 'UniIconsFontFamily',
source: iconpath,
success() { },
fail(err) {
console.log(err);
},
})
const sys = uni.getSystemInfoSync()
const statusBarHeight = sys.statusBarHeight
this.statusBarHeight = statusBarHeight
},
methods: {
back() {
uni.navigateBack({})
}
},
}
</script>
<style>
.uni-icons {
font-family: "UniIconsFontFamily" !important;
font-size: 22px;
font-style: normal;
color: #333;
}
.uni-navbar {
border: 1px #eee solid;
background-color: #fff;
}
.uni-navbar-inner {
position: relative;
display: flex;
flex-direction: row;
justify-content: space-between;
height: 45px;
}
.left-content,
.right-content {
display: flex;
justify-content: center;
align-items: center;
width: 45px;
height: 100%;
}
.uni-navbar-content {
position: absolute;
height: 100%;
top: 0;
bottom: 0;
left: 45px;
right: 45px;
display: flex;
justify-content: center;
align-items: center;
}
</style>
\ No newline at end of file
components/uni-tabbar-light/uni-tabbar-light.vue
0 → 100644
浏览文件 @
afdeb884
<
template
>
<view
class=
"uni-navbar"
>
<view
class=
"uni-navbar-inner"
:style=
"navbarStyle"
>
<view
class=
"left-content"
@
click=
"back"
>
<text
class=
"uni-icons uniui-back"
></text>
</view>
<view
class=
"uni-navbar-content"
>
<slot>
{{
title
}}
</slot>
</view>
<view
class=
"right-content"
>
<slot
name=
"right"
></slot>
</view>
</view>
</view>
</
template
>
<
script
>
export
default
{
name
:
"
uni-navbar
"
,
props
:
{
title
:
{
type
:
String
,
default
:
''
}
},
data
()
{
return
{
statusBarHeight
:
0
};
},
computed
:
{
navbarStyle
()
{
return
`margin-top:
${
this
.
statusBarHeight
}
px`
},
},
created
()
{
const
sys
=
uni
.
getSystemInfoSync
()
const
statusBarHeight
=
sys
.
statusBarHeight
this
.
statusBarHeight
=
statusBarHeight
},
methods
:
{
back
()
{
uni
.
navigateBack
({})
}
},
}
</
script
>
<
style
>
@import
'./uni-icons.css'
;
.uni-icons
{
font-family
:
UniIconsLight
;
text-decoration
:
none
;
text-align
:
center
;
font-size
:
22px
;
font-style
:
normal
;
color
:
#333
;
}
.uni-navbar
{
border
:
1px
#eee
solid
;
background-color
:
#fff
;
}
.uni-navbar-inner
{
position
:
relative
;
display
:
flex
;
flex-direction
:
row
;
justify-content
:
space-between
;
height
:
45px
;
}
.left-content
,
.right-content
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
width
:
45px
;
height
:
100%
;
}
.uni-navbar-content
{
position
:
absolute
;
height
:
100%
;
top
:
0
;
bottom
:
0
;
left
:
45px
;
right
:
45px
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
</
style
>
components/uni-tabbar-light/uniicons.ttf
0 → 100644
浏览文件 @
afdeb884
文件已添加
pages.json
浏览文件 @
afdeb884
...
...
@@ -909,6 +909,15 @@
}
}
,{
"path"
:
"pages/template/navbar-light/navbar-light"
,
"style"
:
{
"navigationBarTitleText"
:
"自定义导航栏"
,
"navigationStyle"
:
"custom"
}
}
],
"globalStyle"
:
{
"pageOrientation"
:
"portrait"
,
...
...
pages/tabBar/template.uvue
浏览文件 @
afdeb884
...
...
@@ -159,6 +159,13 @@ export default {
name: '划走式卡片',
open: false,
pages: [] as Page[],
},
{
id: 'navbar-light',
url: 'navbar-light',
name: '自定义导航栏',
open: false,
pages: [] as Page[],
},
{
id: 'calendar',
...
...
pages/template/navbar-light/navbar-light.uvue
0 → 100644
浏览文件 @
afdeb884
<template>
<view class="content">
<uni-tabbar-light :title="title"></uni-tabbar-light>
<scroll-view class="scroll-view" scroll-y="true">
<view class="content-item" v-for="item in 100">
<text class="text">内容:{{item+1}}</text>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello uni-app'
}
},
onLoad() {},
methods: {}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
flex: 1;
}
.scroll-view {
flex: 1;
background-color: #f5f5f5;
padding: 5px 0;
}
.content-item {
padding: 15px;
margin: 5px 10px;
background-color: #fff;
border-radius: 5px;
}
.text {
font-size: 14px;
color: #666;
}
</style>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录