仿互站小程序
This commit is contained in:
31
vant/card/index.js
Normal file
31
vant/card/index.js
Normal file
@@ -0,0 +1,31 @@
|
||||
var i = require("../mixins/link");
|
||||
|
||||
(0, require("../common/component").VantComponent)({
|
||||
classes: [ "num-class", "desc-class", "thumb-class", "title-class", "price-class", "origin-price-class" ],
|
||||
mixins: [ i.link ],
|
||||
props: {
|
||||
tag: String,
|
||||
num: String,
|
||||
desc: String,
|
||||
thumb: String,
|
||||
title: String,
|
||||
price: String,
|
||||
centered: Boolean,
|
||||
lazyLoad: Boolean,
|
||||
thumbLink: String,
|
||||
originPrice: String,
|
||||
thumbMode: {
|
||||
type: String,
|
||||
value: "aspectFit"
|
||||
},
|
||||
currency: {
|
||||
type: String,
|
||||
value: "¥"
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClickThumb: function() {
|
||||
this.jumpLink("thumbLink");
|
||||
}
|
||||
}
|
||||
});
|
14
vant/card/index.json
Normal file
14
vant/card/index.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-tag": "../tag/index",
|
||||
"forview": "/utils/forview/index",
|
||||
"van-loading": "/vant/loading/index",
|
||||
"van-dialog": "/vant/dialog/index",
|
||||
"van-button": "/vant/button/index",
|
||||
"van-icon": "/vant/icon/index",
|
||||
"van-popup": "/vant/popup/index",
|
||||
"van-tab": "/vant/tab/index",
|
||||
"van-tabs": "/vant/tabs/index"
|
||||
}
|
||||
}
|
27
vant/card/index.wxml
Normal file
27
vant/card/index.wxml
Normal file
@@ -0,0 +1,27 @@
|
||||
<view class="custom-class van-card">
|
||||
<view class="{{utils.bem( 'card__header',{center:centered} )}}">
|
||||
<view bind:tap="onClickThumb" class="van-card__thumb">
|
||||
<image class="van-card__img thumb-class" lazyLoad="{{lazyLoad}}" mode="{{thumbMode}}" src="{{thumb}}" wx:if="{{thumb}}"></image>
|
||||
<slot name="thumb"></slot>
|
||||
<van-tag mark customClass="van-card__tag" type="danger" wx:if="{{tag}}">
|
||||
{{tag}}
|
||||
</van-tag>
|
||||
</view>
|
||||
<view class="van-card__content">
|
||||
<view class="van-card__title title-class" wx:if="{{title}}">{{title}}</view>
|
||||
<slot name="title" wx:else></slot>
|
||||
<view class="van-card__desc desc-class" wx:if="{{desc}}">{{desc}}</view>
|
||||
<slot name="desc" wx:else></slot>
|
||||
<slot name="tags"></slot>
|
||||
<view class="van-card__bottom">
|
||||
<view class="van-card__price price-class" wx:if="{{price||price===0}}">{{currency}} {{price}}</view>
|
||||
<view class="van-card__origin-price origin-price-class" wx:if="{{originPrice||originPrice===0}}">{{currency}} {{originPrice}}</view>
|
||||
<view class="van-card__num num-class" wx:if="{{num}}">x {{num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="van-card__footer">
|
||||
<slot name="footer"></slot>
|
||||
</view>
|
||||
</view>
|
||||
<wxs module="utils" src="../wxs/utils.wxs" />
|
89
vant/card/index.wxss
Normal file
89
vant/card/index.wxss
Normal file
@@ -0,0 +1,89 @@
|
||||
@import "../area/index.wxss";
|
||||
|
||||
.van-card {
|
||||
position: relative;
|
||||
padding: 5px 15px;
|
||||
font-size: 12px;
|
||||
color: #333;
|
||||
background-color: #fafafa;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.van-card__header {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.van-card__header--center {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.van-card__thumb {
|
||||
position: relative;
|
||||
width: 90px;
|
||||
height: 90px;
|
||||
margin-right: 10px;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.van-card__thumb:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.van-card__img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.van-card__content {
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.van-card__desc,.van-card__title {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.van-card__title {
|
||||
font-weight: 700;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.van-card__desc {
|
||||
color: #7d7e80;
|
||||
}
|
||||
|
||||
.van-card__bottom,.van-card__desc {
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.van-card__price {
|
||||
display: inline-block;
|
||||
font-weight: 700;
|
||||
color: #f44;
|
||||
}
|
||||
|
||||
.van-card__origin-price {
|
||||
display: inline-block;
|
||||
margin-left: 5px;
|
||||
font-size: 10px;
|
||||
color: #7d7e80;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.van-card__num {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.van-card__tag {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.van-card__footer {
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
flex: none;
|
||||
}
|
Reference in New Issue
Block a user