first
This commit is contained in:
1
node_modules/vant/es/coupon-cell/index.css
generated
vendored
Normal file
1
node_modules/vant/es/coupon-cell/index.css
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
.van-coupon-cell__value--selected{color:#323233}
|
79
node_modules/vant/es/coupon-cell/index.js
generated
vendored
Normal file
79
node_modules/vant/es/coupon-cell/index.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
|
||||
// Utils
|
||||
import { createNamespace, isDef } from '../utils';
|
||||
import { inherit } from '../utils/functional'; // Components
|
||||
|
||||
import Cell from '../cell'; // Types
|
||||
|
||||
var _createNamespace = createNamespace('coupon-cell'),
|
||||
createComponent = _createNamespace[0],
|
||||
bem = _createNamespace[1],
|
||||
t = _createNamespace[2];
|
||||
|
||||
function formatValue(props) {
|
||||
var coupons = props.coupons,
|
||||
chosenCoupon = props.chosenCoupon,
|
||||
currency = props.currency;
|
||||
var coupon = coupons[+chosenCoupon];
|
||||
|
||||
if (coupon) {
|
||||
var value = 0;
|
||||
|
||||
if (isDef(coupon.value)) {
|
||||
value = coupon.value;
|
||||
} else if (isDef(coupon.denominations)) {
|
||||
value = coupon.denominations;
|
||||
}
|
||||
|
||||
return "-" + currency + " " + (value / 100).toFixed(2);
|
||||
}
|
||||
|
||||
return coupons.length === 0 ? t('tips') : t('count', coupons.length);
|
||||
}
|
||||
|
||||
function CouponCell(h, props, slots, ctx) {
|
||||
var selected = props.coupons[+props.chosenCoupon];
|
||||
var value = formatValue(props);
|
||||
return h(Cell, _mergeJSXProps([{
|
||||
"class": bem(),
|
||||
"attrs": {
|
||||
"value": value,
|
||||
"title": props.title || t('title'),
|
||||
"border": props.border,
|
||||
"isLink": props.editable,
|
||||
"valueClass": bem('value', {
|
||||
selected: selected
|
||||
})
|
||||
}
|
||||
}, inherit(ctx, true)]));
|
||||
}
|
||||
|
||||
CouponCell.model = {
|
||||
prop: 'chosenCoupon'
|
||||
};
|
||||
CouponCell.props = {
|
||||
title: String,
|
||||
coupons: {
|
||||
type: Array,
|
||||
default: function _default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
currency: {
|
||||
type: String,
|
||||
default: '¥'
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
editable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
chosenCoupon: {
|
||||
type: [Number, String],
|
||||
default: -1
|
||||
}
|
||||
};
|
||||
export default createComponent(CouponCell);
|
7
node_modules/vant/es/coupon-cell/index.less
generated
vendored
Normal file
7
node_modules/vant/es/coupon-cell/index.less
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
@import '../style/var';
|
||||
|
||||
.van-coupon-cell {
|
||||
&__value--selected {
|
||||
color: @coupon-cell-selected-text-color;
|
||||
}
|
||||
}
|
6
node_modules/vant/es/coupon-cell/style/index.js
generated
vendored
Normal file
6
node_modules/vant/es/coupon-cell/style/index.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import '../../style/base.css';
|
||||
import '../../info/index.css';
|
||||
import '../../icon/index.css';
|
||||
import '../../coupon/index.css';
|
||||
import '../../cell/index.css';
|
||||
import '../index.css';
|
6
node_modules/vant/es/coupon-cell/style/less.js
generated
vendored
Normal file
6
node_modules/vant/es/coupon-cell/style/less.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import '../../style/base.less';
|
||||
import '../../info/index.less';
|
||||
import '../../icon/index.less';
|
||||
import '../../coupon/index.less';
|
||||
import '../../cell/index.less';
|
||||
import '../index.less';
|
Reference in New Issue
Block a user