5 changed files with 266 additions and 225 deletions
@ -1,119 +1,122 @@ |
|||||
<template> |
<template> |
||||
<view class="im-nav-bar"> |
<view class="im-nav-bar"> |
||||
<!-- #ifndef H5 --> |
<!-- #ifdef APP-PLUS --> |
||||
<view style="height: var(--status-bar-height)"></view> |
<view style="height: var(--status-bar-height)"></view> |
||||
<!-- #endif --> |
<!-- #endif --> |
||||
<view class="im-nav-bar-content"> |
<view class="im-nav-bar-content"> |
||||
<view class="back" @click="handleBackClick" v-if="back"> |
<!-- #ifndef MP-WEIXIN --> |
||||
<uni-icons type="back" :size="iconFontSize"></uni-icons> |
<view class="back" @click="handleBackClick" v-if="back"> |
||||
</view> |
<uni-icons type="back" :size="iconFontSize"></uni-icons> |
||||
<view class="title" v-if="title"> |
</view> |
||||
<slot></slot> |
<!-- #endif --> |
||||
</view> |
<view class="title" v-if="title"> |
||||
<view class="btn"> |
<slot></slot> |
||||
<uni-icons class="btn-item" v-if="search" type="search" :size="iconFontSize" |
</view> |
||||
@click="$emit('search')"></uni-icons> |
<view class="btn"> |
||||
<uni-icons class="btn-item" v-if="add" type="plusempty" :size="iconFontSize" @click="$emit('add')"></uni-icons> |
<uni-icons class="btn-item" v-if="search" type="search" :size="iconFontSize" |
||||
<uni-icons class="btn-item" v-if="more" type="more-filled" :size="iconFontSize" |
@click="$emit('search')"></uni-icons> |
||||
@click="$emit('more')"></uni-icons> |
<uni-icons class="btn-item" v-if="add" type="plusempty" :size="iconFontSize" |
||||
</view> |
@click="$emit('add')"></uni-icons> |
||||
</view> |
<uni-icons class="btn-item" v-if="more" type="more-filled" :size="iconFontSize" |
||||
</view> |
@click="$emit('more')"></uni-icons> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
export default { |
export default { |
||||
name: "nav-bar", |
name: "nav-bar", |
||||
props: { |
props: { |
||||
back: { |
back: { |
||||
type: Boolean, |
type: Boolean, |
||||
default: false |
default: false |
||||
}, |
}, |
||||
title: { |
title: { |
||||
type: Boolean, |
type: Boolean, |
||||
default: true |
default: true |
||||
}, |
}, |
||||
search: { |
search: { |
||||
type: Boolean, |
type: Boolean, |
||||
default: false |
default: false |
||||
}, |
}, |
||||
add: { |
add: { |
||||
type: Boolean, |
type: Boolean, |
||||
default: false |
default: false |
||||
}, |
}, |
||||
more: { |
more: { |
||||
type: Boolean, |
type: Boolean, |
||||
default: false |
default: false |
||||
}, |
}, |
||||
iconFontSize: { |
iconFontSize: { |
||||
type: Number, |
type: Number, |
||||
default: 24 |
default: 24 |
||||
} |
} |
||||
}, |
}, |
||||
data() { |
data() { |
||||
return {} |
return {} |
||||
}, |
}, |
||||
computed: { |
computed: { |
||||
height() { |
height() { |
||||
|
|
||||
} |
} |
||||
}, |
}, |
||||
methods: { |
methods: { |
||||
handleBackClick() { |
handleBackClick() { |
||||
uni.navigateBack({ |
uni.navigateBack({ |
||||
delta: 1 |
delta: 1 |
||||
}) |
}) |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
</script> |
</script> |
||||
|
|
||||
<style scoped lang="scss"> |
<style scoped lang="scss"> |
||||
.im-nav-bar { |
.im-nav-bar { |
||||
background-color: #fff; |
background-color: #fff; |
||||
//background-color: $im-bg; |
//background-color: $im-bg; |
||||
position: fixed; |
position: fixed; |
||||
top: 0; |
top: 0; |
||||
width: 100%; |
width: 100%; |
||||
color: $im-text-color; |
color: $im-text-color; |
||||
border-bottom: 1px solid $im-border-light; |
border-bottom: 1px solid $im-border-light; |
||||
font-size: $im-font-size-large; |
font-size: $im-font-size-large; |
||||
z-index: 99; |
z-index: 99; |
||||
|
|
||||
.im-nav-bar-content { |
.im-nav-bar-content { |
||||
display: flex; |
display: flex; |
||||
align-items: center; |
align-items: center; |
||||
justify-content: center; |
justify-content: center; |
||||
box-sizing: border-box; |
box-sizing: border-box; |
||||
height: $im-nav-bar-height; |
height: $im-nav-bar-height; |
||||
|
|
||||
.title {} |
.title {} |
||||
|
|
||||
.back { |
.back { |
||||
position: absolute; |
position: absolute; |
||||
left: 0; |
left: 0; |
||||
height: 100%; |
height: 100%; |
||||
display: flex; |
display: flex; |
||||
align-items: center; |
align-items: center; |
||||
padding: 12px; |
padding: 12px; |
||||
font-size: 22px; |
font-size: 22px; |
||||
box-sizing: border-box; |
box-sizing: border-box; |
||||
} |
} |
||||
|
|
||||
.btn { |
.btn { |
||||
position: absolute; |
position: absolute; |
||||
right: 0; |
right: 0; |
||||
height: 100%; |
height: 100%; |
||||
display: flex; |
display: flex; |
||||
padding: 12px; |
padding: 12px; |
||||
align-items: center; |
align-items: center; |
||||
box-sizing: border-box; |
box-sizing: border-box; |
||||
|
|
||||
.btn-item { |
.btn-item { |
||||
margin-left: 8px; |
margin-left: 8px; |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
} |
} |
||||
</style> |
</style> |
||||
Loading…
Reference in new issue