仿互站小程序
This commit is contained in:
34
vant/cell/index.js
Normal file
34
vant/cell/index.js
Normal file
@@ -0,0 +1,34 @@
|
||||
var e = require("../mixins/link");
|
||||
|
||||
(0, require("../common/component").VantComponent)({
|
||||
classes: [ "title-class", "label-class", "value-class", "right-icon-class", "hover-class" ],
|
||||
mixins: [ e.link ],
|
||||
props: {
|
||||
title: null,
|
||||
value: null,
|
||||
icon: String,
|
||||
size: String,
|
||||
label: String,
|
||||
center: Boolean,
|
||||
isLink: Boolean,
|
||||
required: Boolean,
|
||||
clickable: Boolean,
|
||||
titleWidth: String,
|
||||
customStyle: String,
|
||||
arrowDirection: String,
|
||||
useLabelSlot: Boolean,
|
||||
hidden: {
|
||||
type: Boolean,
|
||||
value: !1
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: !0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick: function(e) {
|
||||
this.$emit("click", e.detail), this.jumpLink();
|
||||
}
|
||||
}
|
||||
});
|
13
vant/cell/index.json
Normal file
13
vant/cell/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"
|
||||
}
|
||||
}
|
22
vant/cell/index.wxml
Normal file
22
vant/cell/index.wxml
Normal file
@@ -0,0 +1,22 @@
|
||||
<view bind:tap="onClick" class="custom-class {{utils.bem( 'cell',[ size,{center:center,required:required,borderless:!border,clickable:isLink||clickable} ] )}}" hidden="{{hidden}}" hoverClass="van-cell--hover hover-class" hoverStayTime="70" style="{{customStyle}}">
|
||||
<view class="van-cell__body">
|
||||
<van-icon class="van-cell__left-icon-wrap" customClass="van-cell__left-icon" name="{{icon}}" wx:if="{{icon}}"></van-icon>
|
||||
<slot name="icon" wx:else></slot>
|
||||
<view class="van-cell__title title-class" style="{{titleWidth?'max-width:'+titleWidth+';min-width:'+titleWidth:''}}">
|
||||
<block wx:if="{{title}}">{{title}}</block>
|
||||
<slot name="title" wx:else></slot>
|
||||
</view>
|
||||
<view class="van-cell__value value-class">
|
||||
<block wx:if="{{value||value===0}}">{{value}}</block>
|
||||
<slot wx:else></slot>
|
||||
</view>
|
||||
<van-icon class="van-cell__right-icon-wrap right-icon-class" customClass="van-cell__right-icon" name="{{arrowDirection?'arrow'+'-'+arrowDirection:'arrow'}}" wx:if="{{isLink||arrowDirection}}"></van-icon>
|
||||
<slot name="right-icon" wx:else></slot>
|
||||
<slot name="extra"></slot>
|
||||
</view>
|
||||
<view class="van-cell__label label-class" wx:if="{{label||useLabelSlot}}">
|
||||
<slot name="label" wx:if="{{useLabelSlot}}"></slot>
|
||||
<rich-text nodes="{{label}}" wx:elif="{{label}}"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
<wxs module="utils" src="../wxs/utils.wxs" />
|
127
vant/cell/index.wxss
Normal file
127
vant/cell/index.wxss
Normal file
@@ -0,0 +1,127 @@
|
||||
@import "../area/index.wxss";
|
||||
|
||||
.van-cell {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding: 10px 0;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
color: #333;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.van-cell:after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
box-sizing: border-box;
|
||||
transform-origin: center;
|
||||
top: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
transform: scaleY(.5);
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.van-cell--borderless:after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.van-cell-group {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.van-cell__body {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.van-cell__label {
|
||||
margin-top: 1px;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: #999;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.van-cell__value {
|
||||
overflow: hidden;
|
||||
color: #999;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.van-cell__title {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.van-cell__title,.van-cell__value {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.van-cell__title:empty,.van-cell__value:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.van-cell__left-icon-wrap,.van-cell__right-icon-wrap {
|
||||
display: flex;
|
||||
height: 24px;
|
||||
font-size: 16px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.van-cell__left-icon-wrap {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.van-cell__right-icon-wrap {
|
||||
margin-left: 5px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.van-cell__left-icon {
|
||||
line-height: 24px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.van-cell__right-icon {
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.van-cell--clickable.van-cell--hover {
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
.van-cell--required {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.van-cell--required .van-cell__title:before {
|
||||
position: absolute;
|
||||
left: -9px;
|
||||
line-height: 12px;
|
||||
height: 12px;
|
||||
top: 0;
|
||||
margin-top: 9px;
|
||||
color: #f44;
|
||||
content: "*";
|
||||
}
|
||||
|
||||
.van-cell--center {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.van-cell--large {
|
||||
padding-top: 12px;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.van-cell--large .van-cell__title {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.van-cell--large .van-cell__label {
|
||||
font-size: 14px;
|
||||
}
|
Reference in New Issue
Block a user