仿互站小程序
This commit is contained in:
31
vant/nav-bar/index.js
Normal file
31
vant/nav-bar/index.js
Normal file
@@ -0,0 +1,31 @@
|
||||
var e = require("../common/component"), t = require("../mixins/safe-area");
|
||||
|
||||
(0, e.VantComponent)({
|
||||
mixins: [ (0, t.safeArea)({
|
||||
safeAreaInsetTop: !0
|
||||
}) ],
|
||||
classes: [ "title-class" ],
|
||||
props: {
|
||||
title: String,
|
||||
fixed: Boolean,
|
||||
leftText: String,
|
||||
rightText: String,
|
||||
leftArrow: Boolean,
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: !0
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
value: 120
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClickLeft: function() {
|
||||
this.$emit("click-left");
|
||||
},
|
||||
onClickRight: function() {
|
||||
this.$emit("click-right");
|
||||
}
|
||||
}
|
||||
});
|
13
vant/nav-bar/index.json
Normal file
13
vant/nav-bar/index.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index",
|
||||
"forview": "/utils/forview/index",
|
||||
"van-loading": "/vant/loading/index",
|
||||
"van-dialog": "/vant/dialog/index",
|
||||
"van-button": "/vant/button/index",
|
||||
"van-popup": "/vant/popup/index",
|
||||
"van-tab": "/vant/tab/index",
|
||||
"van-tabs": "/vant/tabs/index"
|
||||
}
|
||||
}
|
18
vant/nav-bar/index.wxml
Normal file
18
vant/nav-bar/index.wxml
Normal file
@@ -0,0 +1,18 @@
|
||||
<view class="{{utils.bem( 'nav-bar',{fixed:fixed} )}} custom-class {{border?'van-hairline--bottom':''}}" style="z-index: {{zIndex}}; {{safeAreaInsetTop?'padding-top: '+statusBarHeight+'px;':''}}">
|
||||
<view bind:tap="onClickLeft" class="van-nav-bar__left">
|
||||
<block wx:if="{{leftArrow||leftText}}">
|
||||
<van-icon customClass="van-nav-bar__arrow" name="arrow-left" size="16px" wx:if="{{leftArrow}}"></van-icon>
|
||||
<view class="van-nav-bar__text" hoverClass="van-nav-bar__text--hover" hoverStayTime="70" wx:if="{{leftText}}">{{leftText}}</view>
|
||||
</block>
|
||||
<slot name="left" wx:else></slot>
|
||||
</view>
|
||||
<view class="van-nav-bar__title title-class van-ellipsis">
|
||||
<block wx:if="{{title}}">{{title}}</block>
|
||||
<slot name="title" wx:else></slot>
|
||||
</view>
|
||||
<view bind:tap="onClickRight" class="van-nav-bar__right">
|
||||
<view class="van-nav-bar__text" hoverClass="van-nav-bar__text--hover" hoverStayTime="70" wx:if="{{rightText}}">{{rightText}}</view>
|
||||
<slot name="right" wx:else></slot>
|
||||
</view>
|
||||
</view>
|
||||
<wxs module="utils" src="../wxs/utils.wxs" />
|
60
vant/nav-bar/index.wxss
Normal file
60
vant/nav-bar/index.wxss
Normal file
@@ -0,0 +1,60 @@
|
||||
@import "../area/index.wxss";
|
||||
|
||||
.van-nav-bar {
|
||||
position: relative;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.van-nav-bar__text {
|
||||
display: inline-block;
|
||||
padding: 0 15px;
|
||||
margin: 0 -15px;
|
||||
color: #1989fa;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.van-nav-bar__text--hover {
|
||||
background-color: #f2f3f5;
|
||||
}
|
||||
|
||||
.van-nav-bar__arrow {
|
||||
color: #1989fa;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.van-nav-bar__arrow+.van-nav-bar__text {
|
||||
padding-left: 25px;
|
||||
margin-left: -20px;
|
||||
}
|
||||
|
||||
.van-nav-bar--fixed {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.van-nav-bar__title {
|
||||
max-width: 60%;
|
||||
margin: 0 auto;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.van-nav-bar__left,.van-nav-bar__right {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.van-nav-bar__left {
|
||||
left: 15px;
|
||||
}
|
||||
|
||||
.van-nav-bar__right {
|
||||
right: 15px;
|
||||
}
|
Reference in New Issue
Block a user