add NavBar component
This commit is contained in:
@@ -22,6 +22,7 @@ import Icon from './icon';
|
||||
import ImagePreview from './image-preview';
|
||||
import Lazyload from './lazyload';
|
||||
import Loading from './loading';
|
||||
import NavBar from './nav-bar';
|
||||
import NoticeBar from './notice-bar';
|
||||
import Panel from './panel';
|
||||
import Picker from './picker';
|
||||
@@ -71,6 +72,7 @@ const components = [
|
||||
GoodsActionMiniBtn,
|
||||
Icon,
|
||||
Loading,
|
||||
NavBar,
|
||||
NoticeBar,
|
||||
Panel,
|
||||
Picker,
|
||||
@@ -136,6 +138,7 @@ export {
|
||||
ImagePreview,
|
||||
Lazyload,
|
||||
Loading,
|
||||
NavBar,
|
||||
NoticeBar,
|
||||
Panel,
|
||||
Picker,
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<div :class="['van-nav-bar van-hairline--top-bottom', { 'van-nav-bar--fixed': fixed }]">
|
||||
<div class="van-nav-bar__left" @click="$emit('clickLeft')">
|
||||
<slot name="left">
|
||||
<van-icon v-if="leftArrow" class="van-nav-bar__arrow" name="arrow" />
|
||||
<span v-if="leftText" v-text="leftText" class="van-nav-bar__text" />
|
||||
</slot>
|
||||
</div>
|
||||
<div class="van-nav-bar__title">
|
||||
<slot name="title">{{ title }}</slot>
|
||||
</div>
|
||||
<div class="van-nav-bar__right" @click="$emit('clickRight')">
|
||||
<slot name="right">
|
||||
<span v-if="rightText" v-text="rightText" class="van-nav-bar__text" />
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Icon from '../icon';
|
||||
|
||||
export default {
|
||||
name: 'van-nav-bar',
|
||||
|
||||
components: {
|
||||
[Icon.name]: Icon
|
||||
},
|
||||
|
||||
props: {
|
||||
title: String,
|
||||
leftText: String,
|
||||
rightText: String,
|
||||
leftArrow: Boolean,
|
||||
fixed: Boolean
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -15,6 +15,8 @@
|
||||
@import './card.css';
|
||||
@import './icon.css';
|
||||
@import './loading.css';
|
||||
@import './nav-bar.css';
|
||||
@import './notice-bar.css';
|
||||
@import './popup.css';
|
||||
@import './search.css';
|
||||
@import './panel.css';
|
||||
@@ -48,5 +50,4 @@
|
||||
/* business components */
|
||||
@import './coupon-list.css';
|
||||
@import './goods-action.css';
|
||||
@import './notice-bar.css';
|
||||
@import './submit-bar.css';
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
@import './common/var.css';
|
||||
|
||||
.van-nav-bar {
|
||||
height: 46px;
|
||||
position: relative;
|
||||
user-select: none;
|
||||
text-align: center;
|
||||
line-height: 46px;
|
||||
background-color: #fff;
|
||||
|
||||
.van-icon {
|
||||
color: $blue;
|
||||
}
|
||||
|
||||
&__arrow {
|
||||
transform: rotate(180deg);
|
||||
|
||||
+ .van-nav-bar__text {
|
||||
margin-left: -20px;
|
||||
padding-left: 25px;
|
||||
}
|
||||
}
|
||||
|
||||
&--fixed {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
&__left,
|
||||
&__right {
|
||||
bottom: 0;
|
||||
font-size: 14px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
&__left {
|
||||
left: 15px;
|
||||
}
|
||||
|
||||
&__right {
|
||||
right: 15px;
|
||||
}
|
||||
|
||||
&__text {
|
||||
color: $blue;
|
||||
margin: 0 -15px;
|
||||
padding: 0 15px;
|
||||
display: inline-block;
|
||||
|
||||
&:active {
|
||||
background-color: $active-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user