仿互站小程序

This commit is contained in:
Drawfans
2020-06-09 16:17:23 +08:00
commit 7bfd53851e
321 changed files with 22890 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
var e = require("../common/component"), t = require("../mixins/safe-area");
(0, e.VantComponent)({
mixins: [ (0, t.safeArea)() ],
props: {
show: Boolean,
title: String,
cancelText: String,
zIndex: {
type: Number,
value: 100
},
actions: {
type: Array,
value: []
},
overlay: {
type: Boolean,
value: !0
},
closeOnClickOverlay: {
type: Boolean,
value: !0
}
},
methods: {
onSelect: function(e) {
var t = e.currentTarget.dataset.index, n = this.data.actions[t];
!n || n.disabled || n.loading || this.$emit("select", n);
},
onCancel: function() {
this.$emit("cancel");
},
onClose: function() {
this.$emit("close");
}
}
});

View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-popup": "../popup/index",
"van-loading": "../loading/index",
"forview": "/utils/forview/index",
"van-dialog": "/vant/dialog/index",
"van-button": "/vant/button/index",
"van-tab": "/vant/tab/index",
"van-tabs": "/vant/tabs/index"
}
}

View File

@@ -0,0 +1,20 @@
<van-popup bind:close="onClose" closeOnClickOverlay="{{closeOnClickOverlay}}" customClass="van-action-sheet" overlay="{{overlay}}" position="bottom" safeAreaInsetBottom="{{safeAreaInsetBottom}}" show="{{show}}" zIndex="{{zIndex}}">
<view class="van-hairline--bottom van-action-sheet__header" wx:if="{{title}}">
{{title}}
<van-icon bind:click="onClose" customClass="van-action-sheet__close" name="close"></van-icon>
</view>
<view wx:if="{{actions&&actions.length}}">
<button bind:tap="onSelect" class="{{utils.bem( 'action-sheet__item',{disabled:item.disabled||item.loading} )}} van-hairline--top {{item.className||''}}" data-index="{{index}}" hoverClass="van-action-sheet__item--hover" openType="{{item.openType}}" wx:for="{{actions}}" wx:key="index">
<block wx:if="{{!item.loading}}">
{{item.name}}
<text class="van-action-sheet__subname" wx:if="{{item.subname}}">{{item.subname}}</text>
</block>
<van-loading size="20px" wx:else></van-loading>
</button>
</view>
<slot></slot>
<view bind:tap="onCancel" class="van-action-sheet__cancel" hoverClass="van-action-sheet__cancel--hover" hoverStayTime="70" wx:if="{{cancelText}}">
{{cancelText}}
</view>
</van-popup>
<wxs module="utils" src="../wxs/utils.wxs" />

View File

@@ -0,0 +1,60 @@
@import "../area/index.wxss";
.van-action-sheet {
max-height: 90%!important;
color: #333;
}
.van-action-sheet__cancel,.van-action-sheet__item {
height: 50px;
font-size: 16px;
line-height: 50px;
text-align: center;
background-color: #fff;
}
.van-action-sheet__cancel--hover,.van-action-sheet__item--hover {
background-color: #f2f3f5;
}
.van-action-sheet__cancel {
height: 60px;
}
.van-action-sheet__cancel:before {
display: block;
height: 10px;
background-color: #f8f8f8;
content: " ";
}
.van-action-sheet__item--disabled {
color: #c9c9c9;
}
.van-action-sheet__item--disabled.van-action-sheet__item--hover {
background-color: #fff;
}
.van-action-sheet__subname {
margin-left: 5px;
font-size: 12px;
color: #7d7e80;
}
.van-action-sheet__header {
font-size: 16px;
font-weight: 500;
line-height: 44px;
text-align: center;
}
.van-action-sheet__close {
position: absolute!important;
top: 0;
right: 0;
padding: 0 15px;
font-size: 18px!important;
line-height: inherit!important;
color: #999;
}

155
vant/area/index.js Normal file
View File

@@ -0,0 +1,155 @@
var e = function() {
function e(e, t) {
var n = [], i = !0, r = !1, s = void 0;
try {
for (var c, u = e[Symbol.iterator](); !(i = (c = u.next()).done) && (n.push(c.value),
!t || n.length !== t); i = !0) ;
} catch (e) {
r = !0, s = e;
} finally {
try {
!i && u.return && u.return();
} finally {
if (r) throw s;
}
}
return n;
}
return function(t, n) {
if (Array.isArray(t)) return t;
if (Symbol.iterator in Object(t)) return e(t, n);
throw new TypeError("Invalid attempt to destructure non-iterable instance");
};
}(), t = require("../common/component"), n = require("../picker/shared");
(0, t.VantComponent)({
classes: [ "active-class", "toolbar-class", "column-class" ],
props: Object.assign({}, n.pickerProps, {
value: String,
areaList: {
type: Object,
value: {}
},
columnsNum: {
type: [ String, Number ],
value: 3
}
}),
data: {
columns: [ {
values: []
}, {
values: []
}, {
values: []
} ],
displayColumns: [ {
values: []
}, {
values: []
}, {
values: []
} ]
},
watch: {
value: function(e) {
this.code = e, this.setValues();
},
areaList: "setValues",
columnsNum: function(e) {
this.set({
displayColumns: this.data.columns.slice(0, +e)
});
}
},
mounted: function() {
this.setValues();
},
methods: {
getPicker: function() {
return null == this.picker && (this.picker = this.selectComponent(".van-area__picker")),
this.picker;
},
onCancel: function(e) {
this.emit("cancel", e.detail);
},
onConfirm: function(e) {
this.emit("confirm", e.detail);
},
emit: function(e, t) {
t.values = t.value, delete t.value, this.$emit(e, t);
},
onChange: function(e) {
var t = this, n = e.detail, i = n.index, r = n.picker, s = n.value;
this.code = s[i].code, this.setValues().then(function() {
t.$emit("change", {
picker: r,
values: r.getValues(),
index: i
});
});
},
getConfig: function(e) {
var t = this.data.areaList;
return t && t[e + "_list"] || {};
},
getList: function(e, t) {
var n = [];
if ("province" !== e && !t) return n;
var i = this.getConfig(e);
return n = Object.keys(i).map(function(e) {
return {
code: e,
name: i[e]
};
}), t && ("9" === t[0] && "city" === e && (t = "9"), n = n.filter(function(e) {
return 0 === e.code.indexOf(t);
})), n;
},
getIndex: function(e, t) {
var n = "province" === e ? 2 : "city" === e ? 4 : 6, i = this.getList(e, t.slice(0, n - 2));
"9" === t[0] && "province" === e && (n = 1), t = t.slice(0, n);
for (var r = 0; r < i.length; r++) if (i[r].code.slice(0, n) === t) return r;
return 0;
},
setValues: function() {
var t = this, n = this.getConfig("county"), i = this.code || Object.keys(n)[0] || "", r = this.getList("province"), s = this.getList("city", i.slice(0, 2)), c = this.getPicker();
if (c) {
var u = [];
if (u.push(c.setColumnValues(0, r, !1)), u.push(c.setColumnValues(1, s, !1)), s.length && "00" === i.slice(2, 4)) {
var o = e(s, 1);
i = o[0].code;
}
return u.push(c.setColumnValues(2, this.getList("county", i.slice(0, 4)), !1)),
Promise.all(u).catch(function() {}).then(function() {
return c.setIndexes([ t.getIndex("province", i), t.getIndex("city", i), t.getIndex("county", i) ]);
}).catch(function() {});
}
},
getValues: function() {
var e = this.getPicker();
return e ? e.getValues().filter(function(e) {
return !!e;
}) : [];
},
getDetail: function() {
var e = this.getValues(), t = {
code: "",
country: "",
province: "",
city: "",
county: ""
};
if (!e.length) return t;
var n = e.map(function(e) {
return e.name;
});
return t.code = e[e.length - 1].code, "9" === t.code[0] ? (t.country = n[1] || "",
t.province = n[2] || "") : (t.province = n[0] || "", t.city = n[1] || "", t.county = n[2] || ""),
t;
},
reset: function() {
return this.code = "", this.setValues();
}
}
});

14
vant/area/index.json Normal file
View File

@@ -0,0 +1,14 @@
{
"component": true,
"usingComponents": {
"van-picker": "../picker/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"
}
}

1
vant/area/index.wxml Normal file
View File

@@ -0,0 +1 @@
<van-picker showToolbar activeClass="active-class" bind:cancel="onCancel" bind:change="onChange" bind:confirm="onConfirm" cancelButtonText="{{cancelButtonText}}" class="van-area__picker" columnClass="column-class" columns="{{displayColumns}}" confirmButtonText="{{confirmButtonText}}" itemHeight="{{itemHeight}}" loading="{{loading}}" title="{{title}}" toolbarClass="toolbar-class" valueKey="name" visibleItemCount="{{visibleItemCount}}"></van-picker>

68
vant/area/index.wxss Normal file
View File

@@ -0,0 +1,68 @@
.van-ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.van-multi-ellipsis--l2 {
-webkit-line-clamp: 2;
}
.van-multi-ellipsis--l2,.van-multi-ellipsis--l3 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.van-multi-ellipsis--l3 {
-webkit-line-clamp: 3;
}
.van-clearfix:after {
content: "";
display: table;
clear: both;
}
.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom {
position: relative;
}
.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after {
content: " ";
position: absolute;
pointer-events: none;
box-sizing: border-box;
transform-origin: center;
top: -50%;
left: -50%;
right: -50%;
bottom: -50%;
transform: scale(.5);
border: 0 solid #e5e5e5;
}
.van-hairline--top:after {
border-top-width: 1px;
}
.van-hairline--left:after {
border-left-width: 1px;
}
.van-hairline--right:after {
border-right-width: 1px;
}
.van-hairline--bottom:after {
border-bottom-width: 1px;
}
.van-hairline--top-bottom:after {
border-width: 1px 0;
}
.van-hairline--surround:after {
border-width: 1px;
}

34
vant/badge-group/index.js Normal file
View File

@@ -0,0 +1,34 @@
(0, require("../common/component").VantComponent)({
relation: {
name: "badge",
type: "descendant",
linked: function(e) {
this.badges.push(e), this.setActive(this.data.active);
},
unlinked: function(e) {
this.badges = this.badges.filter(function(t) {
return t !== e;
}), this.setActive(this.data.active);
}
},
props: {
active: {
type: Number,
value: 0,
observer: "setActive"
}
},
beforeCreate: function() {
this.badges = [], this.currentActive = -1;
},
methods: {
setActive: function(e) {
var t = this.badges, i = this.currentActive;
if (!t.length) return Promise.resolve();
this.currentActive = e;
var s = [];
return i !== e && t[i] && s.push(t[i].setActive(!1)), t[e] && s.push(t[e].setActive(!0)),
Promise.all(s);
}
}
});

View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"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"
}
}

View File

@@ -0,0 +1,3 @@
<view class="van-badge-group van-hairline--top-bottom custom-class">
<slot></slot>
</view>

View File

@@ -0,0 +1,5 @@
@import "../area/index.wxss";
.van-badge-group {
width: 85px;
}

29
vant/badge/index.js Normal file
View File

@@ -0,0 +1,29 @@
(0, require("../common/component").VantComponent)({
relation: {
type: "ancestor",
name: "badge-group",
linked: function(t) {
this.parent = t;
}
},
props: {
info: null,
title: String
},
methods: {
onClick: function() {
var t = this, e = this.parent;
if (e) {
var n = e.badges.indexOf(this);
e.setActive(n).then(function() {
t.$emit("click", n), e.$emit("change", n);
});
}
},
setActive: function(t) {
return this.set({
active: t
});
}
}
});

14
vant/badge/index.json Normal file
View File

@@ -0,0 +1,14 @@
{
"component": true,
"usingComponents": {
"van-info": "../info/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"
}
}

7
vant/badge/index.wxml Normal file
View File

@@ -0,0 +1,7 @@
<view bind:tap="onClick" class="{{utils.bem( 'badge',{active:active} )}} van-hairline custom-class" hoverClass="van-badge--hover" hoverStayTime="70">
<view class="van-badge__text">
<van-info customStyle="right: 4px" info="{{info}}" wx:if="{{info!==null}}"></van-info>
{{title}}
</view>
</view>
<wxs module="utils" src="../wxs/utils.wxs" />

41
vant/badge/index.wxss Normal file
View File

@@ -0,0 +1,41 @@
@import "../area/index.wxss";
.van-badge {
display: block;
padding: 20px 12px 20px 9px;
overflow: hidden;
font-size: 14px;
line-height: 1.4;
color: #7d7e80;
word-break: break-all;
background-color: #f8f8f8;
border-left: 3px solid transparent;
box-sizing: border-box;
user-select: none;
}
.van-badge--hover {
background-color: #f2f3f5;
}
.van-badge:after {
border-bottom-width: 1px;
}
.van-badge--active {
font-weight: 700;
color: #333;
border-color: #f44;
}
.van-badge--active:after {
border-right-width: 1px;
}
.van-badge--active,.van-badge--active.van-badge--hover {
background-color: #fff;
}
.van-badge__text {
position: relative;
}

54
vant/button/index.js Normal file
View File

@@ -0,0 +1,54 @@
var e = require("../common/component"), t = require("../mixins/button"), i = require("../mixins/open-type");
(0, e.VantComponent)({
mixins: [ t.button, i.openType ],
classes: [ "hover-class", "loading-class" ],
data: {
style: ""
},
props: {
icon: String,
iconstyle: String,
plain: Boolean,
block: Boolean,
round: Boolean,
square: Boolean,
loading: Boolean,
hairline: Boolean,
disabled: Boolean,
loadingText: String,
customStyle: String,
loadingType: {
type: String,
value: "circular"
},
type: {
type: String,
value: "default"
},
size: {
type: String,
value: "normal"
},
loadingSize: {
type: String,
value: "20px"
},
color: {
type: String,
observer: function(e) {
var t = "";
e && (t += "color: " + (this.data.plain ? e : "white") + ";", this.data.plain || (t += "background: " + e + ";"),
-1 !== e.indexOf("gradient") ? t += "border: 0;" : t += "border-color: " + e + ";"),
t !== this.data.style && this.setData({
style: t
});
}
}
},
methods: {
onClick: function() {
this.data.disabled || this.data.loading || this.$emit("click");
}
}
});

13
vant/button/index.json Normal file
View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-loading": "../loading/index",
"forview": "/utils/forview/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"
}
}

15
vant/button/index.wxml Normal file
View File

@@ -0,0 +1,15 @@
<button appParameter="{{appParameter}}" ariaLabel="{{ariaLabel}}" bindcontact="bindContact" binderror="bindError" bindgetphonenumber="bindGetPhoneNumber" bindgetuserinfo="bindGetUserInfo" bindlaunchapp="bindLaunchApp" bindopensetting="bindOpenSetting" bindtap="onClick" businessId="{{businessId}}" class="custom-class {{utils.bem( 'button',[ type,size,{block:block,round:round,plain:plain,square:square,loading:loading,disabled:disabled,hairline:hairline,unclickable:disabled||loading} ] )}} {{hairline?'van-hairline--surround':''}}" hoverClass="van-button--active hover-class" id="{{id}}" lang="{{lang}}" openType="{{openType}}" sendMessageImg="{{sendMessageImg}}" sendMessagePath="{{sendMessagePath}}" sendMessageTitle="{{sendMessageTitle}}" sessionFrom="{{sessionFrom}}" showMessageCard="{{showMessageCard}}" style="{{style}} {{customStyle}}">
<block wx:if="{{loading}}">
<van-loading color="{{type==='default'?'#c9c9c9':'white'}}" customClass="loading-class" size="{{loadingSize}}" type="{{loadingType}}"></van-loading>
<view class="van-button__loading-text" wx:if="{{loadingText}}">
{{loadingText}}
</view>
</block>
<block wx:else>
<van-icon class="van-button__icon" customStyle="line-height: inherit;{{iconstyle}}" name="{{icon}}" size="1.2em" wx:if="{{icon}}"></van-icon>
<view class="van-button__text">
<slot></slot>
</view>
</block>
</button>
<wxs module="utils" src="../wxs/utils.wxs" />

219
vant/button/index.wxss Normal file
View File

@@ -0,0 +1,219 @@
@import "../area/index.wxss";
.van-button {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 0;
line-height: 20px;
text-align: center;
vertical-align: middle;
-webkit-appearance: none;
-webkit-text-size-adjust: 100%;
height: 44px;
height: var(--button-default-height,44px);
font-size: 16px;
font-size: var(--button-default-font-size,16px);
transition: opacity .2s;
transition: opacity var(--animation-duration-fast,.2s);
border-radius: 2px;
border-radius: var(--button-border-radius,2px);
}
.van-button:before {
position: absolute;
top: 50%;
left: 50%;
width: 100%;
height: 100%;
border: inherit;
border-radius: inherit;
transform: translate(-50%,-50%);
opacity: 0;
content: " ";
background-color: #000;
background-color: var(--black,#000);
border-color: #000;
border-color: var(--black,#000);
}
.van-button:after {
border-width: 0;
}
.van-button--active:before {
opacity: .15;
}
.van-button--unclickable:after {
display: none;
}
.van-button--default {
color: #323233;
color: var(--button-default-color,#323233);
background-color: #fff;
background-color: var(--button-default-background-color,#fff);
border: 1px solid #ebedf0;
border: 1px solid var(--button-default-border-color,#ebedf0);
}
.van-button--primary {
color: #fff;
color: var(--button-primary-color,#fff);
background-color: #07c160;
background-color: var(--button-primary-background-color,#07c160);
border: 1px solid #07c160;
border: 1px solid var(--button-primary-border-color,#07c160);
}
.van-button--info {
color: #fff;
color: var(--button-info-color,#fff);
background-color: #1989fa;
background-color: var(--button-info-background-color,#1989fa);
border: 1px solid #1989fa;
border: 1px solid var(--button-info-border-color,#1989fa);
}
.van-button--danger {
color: #fff;
color: var(--button-danger-color,#fff);
background-color: #ee0a24;
background-color: var(--button-danger-background-color,#ee0a24);
border: 1px solid #ee0a24;
border: 1px solid var(--button-danger-border-color,#ee0a24);
}
.van-button--warning {
color: #fff;
color: var(--button-warning-color,#fff);
background-color: #ff976a;
background-color: var(--button-warning-background-color,#ff976a);
border: 1px solid #ff976a;
border: 1px solid var(--button-warning-border-color,#ff976a);
}
.van-button--plain {
background-color: #fff;
background-color: var(--button-plain-background-color,#fff);
}
.van-button--plain.van-button--primary {
color: #07c160;
color: var(--button-primary-background-color,#07c160);
}
.van-button--plain.van-button--info {
color: #1989fa;
color: var(--button-info-background-color,#1989fa);
}
.van-button--plain.van-button--danger {
color: #ee0a24;
color: var(--button-danger-background-color,#ee0a24);
}
.van-button--plain.van-button--warning {
color: #ff976a;
color: var(--button-warning-background-color,#ff976a);
}
.van-button--not {
color: #c8c9cc;
background-color: #f7f8fa;
border: 1px solid #f7f8fa;
}
.van-button--large {
width: 100%;
height: 50px;
height: var(--button-large-height,50px);
}
.van-button--normal {
padding: 0 15px;
font-size: 14px;
font-size: var(--button-normal-font-size,14px);
}
.van-button--small {
min-width: 60px;
min-width: var(--button-small-min-width,60px);
height: 30px;
height: var(--button-small-height,30px);
padding: 0 8px;
padding: 0 var(--padding-xs,8px);
font-size: 12px;
font-size: var(--button-small-font-size,12px);
}
.van-button--mini {
display: inline-block;
min-width: 50px;
min-width: var(--button-mini-min-width,50px);
height: 22px;
height: var(--button-mini-height,22px);
font-size: 10px;
font-size: var(--button-mini-font-size,10px);
}
.van-button--mini+.van-button--mini {
margin-left: 5px;
}
.van-button--block {
display: flex;
width: 100%;
}
.van-button--round {
border-radius: 999px;
border-radius: var(--button-round-border-radius,999px);
}
.van-button--square {
border-radius: 0;
}
.van-button--disabled {
opacity: .5;
opacity: var(--button-disabled-opacity,.5);
}
.van-button__text {
display: inline;
}
.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text {
margin-left: 4px;
}
.van-button__icon {
min-width: 1em;
line-height: inherit!important;
vertical-align: top;
}
.van-button--hairline {
padding-top: 1px;
border-width: 0;
}
.van-button--hairline:after {
border-color: inherit;
border-width: 1px;
border-radius: 4px;
border-radius: calc(var(--button-border-radius, 2px)*2);
}
.van-button--hairline.van-button--round:after {
border-radius: 999px;
border-radius: var(--button-round-border-radius,999px);
}
.van-button--hairline.van-button--square:after {
border-radius: 0;
}

31
vant/card/index.js Normal file
View 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
View 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
View 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
View 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;
}

9
vant/cell-group/index.js Normal file
View File

@@ -0,0 +1,9 @@
(0, require("../common/component").VantComponent)({
props: {
title: String,
border: {
type: Boolean,
value: !0
}
}
});

View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"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"
}
}

View File

@@ -0,0 +1,6 @@
<view class="van-cell-group__title" wx:if="{{title}}">
{{title}}
</view>
<view class="custom-class van-cell-group {{border?'van-hairline--top-bottom':''}}">
<slot></slot>
</view>

View File

@@ -0,0 +1,8 @@
@import "../area/index.wxss";
.van-cell-group__title {
font-size: 14px;
padding: 15px 15px 5px;
color: #999;
line-height: 16px;
}

34
vant/cell/index.js Normal file
View 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
View 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
View 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
View 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;
}

View File

@@ -0,0 +1,35 @@
(0, require("../common/component").VantComponent)({
field: !0,
relation: {
name: "checkbox",
type: "descendant",
linked: function(e) {
var a = this.data, n = a.value, d = a.disabled;
e.set({
value: -1 !== n.indexOf(e.data.name),
disabled: d || e.data.disabled
});
}
},
props: {
max: Number,
value: Array,
disabled: Boolean
},
watch: {
value: function(e) {
this.getRelationNodes("../checkbox/index").forEach(function(a) {
a.set({
value: -1 !== e.indexOf(a.data.name)
});
});
},
disabled: function(e) {
this.getRelationNodes("../checkbox/index").forEach(function(a) {
a.set({
disabled: e || a.data.disabled
});
});
}
}
});

View 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"
}
}

View File

@@ -0,0 +1 @@
<slot></slot>

View File

@@ -0,0 +1 @@
@import "../area/index.wxss";

47
vant/checkbox/index.js Normal file
View File

@@ -0,0 +1,47 @@
(0, require("../common/component").VantComponent)({
field: !0,
relation: {
name: "checkbox-group",
type: "ancestor"
},
classes: [ "icon-class", "label-class" ],
props: {
value: null,
disabled: Boolean,
useIconSlot: Boolean,
checkedClass: String,
checkedColor: String,
noColor: String,
labelPosition: String,
labelDisabled: Boolean,
shape: {
type: String,
value: "round"
}
},
methods: {
emitChange: function(e) {
var a = this.getRelationNodes("../checkbox-group/index")[0];
a ? this.setParentValue(a, e) : (this.$emit("input", e), this.$emit("change", {
checked: e,
name: this.data.name
}));
},
toggle: function() {
this.data.disabled || this.emitChange(!this.data.value);
},
onClickLabel: function() {
this.data.disabled || this.data.labelDisabled || this.emitChange(!this.data.value);
},
setParentValue: function(e, a) {
var t = e.data.value.slice(), i = this.data.name;
if (a) {
if (e.data.max && t.length >= e.data.max) return;
-1 === t.indexOf(i) && (t.push(i), e.$emit("input", t), e.$emit("change", t));
} else {
var n = t.indexOf(i);
-1 !== n && (t.splice(n, 1), e.$emit("input", t), e.$emit("change", t));
}
}
}
});

13
vant/checkbox/index.json Normal file
View 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"
}
}

10
vant/checkbox/index.wxml Normal file
View File

@@ -0,0 +1,10 @@
<view class="van-checkbox custom-class {{value&&checkedClass||''}}">
<view bindtap="toggle" class="van-checkbox__icon-wrap">
<slot name="icon" wx:if="{{useIconSlot}}"></slot>
<van-icon class="{{utils.bem( 'checkbox__icon',[ shape,{disabled:disabled,checked:value} ] )}}" customClass="icon-class" customStyle="line-height: 18px;" name="success" style="{{checkedColor&&value&&!disabled?'border-color:'+checkedColor+'; color:'+checkedColor:''}}" wx:else></van-icon>
</view>
<view bindtap="onClickLabel" class="label-class {{utils.bem( 'checkbox__label',[ labelPosition,{disabled:disabled} ] )}}" style="{{!value?noColor?'color:'+noColor:'color:#666':''}}">
<slot></slot>
</view>
</view>
<wxs module="utils" src="../wxs/utils.wxs" />

65
vant/checkbox/index.wxss Normal file
View File

@@ -0,0 +1,65 @@
@import "../area/index.wxss";
.van-checkbox {
overflow: hidden;
user-select: none;
}
.van-checkbox__icon-wrap,.van-checkbox__label {
display: inline-block;
line-height: 18px;
vertical-align: middle;
}
.van-checkbox__icon {
border-radius: 2px;
display: block;
font-size: 14px;
width: 18px;
height: 18px;
color: transparent;
text-align: center;
box-sizing: border-box;
border: 1px solid #e5e5e5;
transition: .2s;
}
.van-checkbox__icon--round {
width: 19px;
height: 19px;
border-radius: 100%;
}
.van-checkbox__icon--checked {
color: #fff;
border-color: #5FB878;
color: #5FB878;
background-color: #fff;
}
.van-checkbox__icon--disabled {
border-color: #c9c9c9;
background-color: #eee;
}
.van-checkbox__icon--disabled.van-checkbox__icon--checked {
color: #c9c9c9;
}
.van-checkbox__label {
color: #333;
margin-left: 6px;
}
.van-checkbox__label--left {
float: left;
margin: 0 10px 0 0;
}
.van-checkbox__label--disabled {
color: #c9c9c9;
}
.van-checkbox__label:empty {
margin: 0;
}

21
vant/col/index.js Normal file
View File

@@ -0,0 +1,21 @@
(0, require("../common/component").VantComponent)({
relation: {
name: "row",
type: "ancestor"
},
props: {
span: Number,
offset: Number
},
data: {
style: ""
},
methods: {
setGutter: function(t) {
var e = t / 2 + "px", n = t ? "padding-left: " + e + "; padding-right: " + e + ";" : "";
n !== this.data.style && this.set({
style: n
});
}
}
});

13
vant/col/index.json Normal file
View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"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"
}
}

4
vant/col/index.wxml Normal file
View File

@@ -0,0 +1,4 @@
<view class="custom-class {{utils.bem( 'col',[span] )}} {{offset?'van-col--offset-'+offset:''}}" style="{{style}}">
<slot></slot>
</view>
<wxs module="utils" src="../wxs/utils.wxs" />

198
vant/col/index.wxss Normal file
View File

@@ -0,0 +1,198 @@
@import "../area/index.wxss";
.van-col {
float: left;
box-sizing: border-box;
}
.van-col--1 {
width: 4.16666667%;
}
.van-col--offset-1 {
margin-left: 4.16666667%;
}
.van-col--2 {
width: 8.33333333%;
}
.van-col--offset-2 {
margin-left: 8.33333333%;
}
.van-col--3 {
width: 12.5%;
}
.van-col--offset-3 {
margin-left: 12.5%;
}
.van-col--4 {
width: 16.66666667%;
}
.van-col--offset-4 {
margin-left: 16.66666667%;
}
.van-col--5 {
width: 20.83333333%;
}
.van-col--offset-5 {
margin-left: 20.83333333%;
}
.van-col--6 {
width: 25%;
}
.van-col--offset-6 {
margin-left: 25%;
}
.van-col--7 {
width: 29.16666667%;
}
.van-col--offset-7 {
margin-left: 29.16666667%;
}
.van-col--8 {
width: 33.33333333%;
}
.van-col--offset-8 {
margin-left: 33.33333333%;
}
.van-col--9 {
width: 37.5%;
}
.van-col--offset-9 {
margin-left: 37.5%;
}
.van-col--10 {
width: 41.66666667%;
}
.van-col--offset-10 {
margin-left: 41.66666667%;
}
.van-col--11 {
width: 45.83333333%;
}
.van-col--offset-11 {
margin-left: 45.83333333%;
}
.van-col--12 {
width: 50%;
}
.van-col--offset-12 {
margin-left: 50%;
}
.van-col--13 {
width: 54.16666667%;
}
.van-col--offset-13 {
margin-left: 54.16666667%;
}
.van-col--14 {
width: 58.33333333%;
}
.van-col--offset-14 {
margin-left: 58.33333333%;
}
.van-col--15 {
width: 62.5%;
}
.van-col--offset-15 {
margin-left: 62.5%;
}
.van-col--16 {
width: 66.66666667%;
}
.van-col--offset-16 {
margin-left: 66.66666667%;
}
.van-col--17 {
width: 70.83333333%;
}
.van-col--offset-17 {
margin-left: 70.83333333%;
}
.van-col--18 {
width: 75%;
}
.van-col--offset-18 {
margin-left: 75%;
}
.van-col--19 {
width: 79.16666667%;
}
.van-col--offset-19 {
margin-left: 79.16666667%;
}
.van-col--20 {
width: 83.33333333%;
}
.van-col--offset-20 {
margin-left: 83.33333333%;
}
.van-col--21 {
width: 87.5%;
}
.van-col--offset-21 {
margin-left: 87.5%;
}
.van-col--22 {
width: 91.66666667%;
}
.van-col--offset-22 {
margin-left: 91.66666667%;
}
.van-col--23 {
width: 95.83333333%;
}
.van-col--offset-23 {
margin-left: 95.83333333%;
}
.van-col--24 {
width: 100%;
}
.van-col--offset-24 {
margin-left: 100%;
}

View File

@@ -0,0 +1,85 @@
var t = function() {
return new Promise(function(t) {
return setTimeout(t, 20);
});
};
(0, require("../common/component").VantComponent)({
classes: [ "title-class", "content-class" ],
relation: {
name: "collapse",
type: "ancestor",
linked: function(t) {
this.parent = t;
}
},
props: {
name: null,
title: null,
value: null,
icon: String,
label: String,
disabled: Boolean,
clickable: Boolean,
border: {
type: Boolean,
value: !0
},
isLink: {
type: Boolean,
value: !0
}
},
data: {
contentHeight: 0,
expanded: !1,
transition: !1
},
mounted: function() {
var n = this;
this.updateExpanded().then(t).then(function() {
n.set({
transition: !0
});
});
},
methods: {
updateExpanded: function() {
if (!this.parent) return Promise.resolve();
var t = this.parent.data, n = t.value, e = t.accordion, i = this.parent.children, a = void 0 === i ? [] : i, o = this.data.name, s = a.indexOf(this), r = null == o ? s : o, l = e ? n === r : (n || []).some(function(t) {
return t === r;
}), u = [];
return l !== this.data.expanded && u.push(this.updateStyle(l)), u.push(this.set({
index: s,
expanded: l
})), Promise.all(u);
},
updateStyle: function(n) {
var e = this;
return this.getRect(".van-collapse-item__content").then(function(t) {
return t.height;
}).then(function(i) {
return n ? e.set({
contentHeight: i ? i + "px" : "auto"
}) : e.set({
contentHeight: i + "px"
}).then(t).then(function() {
return e.set({
contentHeight: 0
});
});
});
},
onClick: function() {
if (!this.data.disabled) {
var t = this.data, n = t.name, e = t.expanded, i = this.parent.children.indexOf(this), a = null == n ? i : n;
this.parent.switch(a, !e);
}
},
onTransitionEnd: function() {
this.data.expanded && this.set({
contentHeight: "auto"
});
}
}
});

View File

@@ -0,0 +1,14 @@
{
"component": true,
"usingComponents": {
"van-cell": "../cell/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"
}
}

View File

@@ -0,0 +1,14 @@
<view class="van-collapse-item custom-class {{index!==0?'van-hairline--top':''}}">
<van-cell bind:click="onClick" border="{{border&&expanded}}" class="{{utils.bem( 'collapse-item__title',{disabled:disabled,expanded:expanded} )}}" clickable="{{clickable}}" customClass="van-cell" hoverClass="van-cell--hover" icon="{{icon}}" isLink="{{isLink}}" label="{{label}}" rightIconClass="van-cell__right-icon" title="{{title}}" titleClass="title-class" value="{{value}}">
<slot name="title" slot="title"></slot>
<slot name="icon" slot="icon"></slot>
<slot name="value"></slot>
<slot name="right-icon" slot="right-icon"></slot>
</van-cell>
<view bind:transitionend="onTransitionEnd" class="{{utils.bem( 'collapse-item__wrapper',{transition:transition} )}}" style="height: {{contentHeight}};">
<view class="van-collapse-item__content content-class">
<slot></slot>
</view>
</view>
</view>
<wxs module="utils" src="../wxs/utils.wxs" />

View File

@@ -0,0 +1,34 @@
@import "../area/index.wxss";
.van-collapse-item__title .van-cell__right-icon {
transform: rotate(90deg);
transition: .3s;
}
.van-collapse-item__title--expanded .van-cell__right-icon {
transform: rotate(-90deg);
}
.van-collapse-item__title--disabled .van-cell,.van-collapse-item__title--disabled .van-cell__right-icon {
color: #c9c9c9!important;
}
.van-collapse-item__title--disabled .van-cell--hover {
background-color: #fff!important;
}
.van-collapse-item__wrapper {
overflow: hidden;
}
.van-collapse-item__wrapper--transition {
transition: height .3s ease-in-out;
}
.van-collapse-item__content {
padding: 15px;
font-size: 13px;
line-height: 1.5;
color: #999;
background-color: #fff;
}

44
vant/collapse/index.js Normal file
View File

@@ -0,0 +1,44 @@
(0, require("../common/component").VantComponent)({
relation: {
name: "collapse-item",
type: "descendant",
linked: function(e) {
this.children.push(e);
},
unlinked: function(e) {
this.children = this.children.filter(function(n) {
return n !== e;
});
}
},
props: {
value: {
type: null,
observer: "updateExpanded"
},
accordion: {
type: Boolean,
observer: "updateExpanded"
},
border: {
type: Boolean,
value: !0
}
},
beforeCreate: function() {
this.children = [];
},
methods: {
updateExpanded: function() {
this.children.forEach(function(e) {
e.updateExpanded();
});
},
switch: function(e, n) {
var t = this.data, i = t.accordion, o = t.value;
e = i ? n ? e : "" : n ? (o || []).concat(e) : (o || []).filter(function(n) {
return n !== e;
}), this.$emit("change", e), this.$emit("input", e);
}
}
});

13
vant/collapse/index.json Normal file
View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"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"
}
}

3
vant/collapse/index.wxml Normal file
View File

@@ -0,0 +1,3 @@
<view class="custom-class van-collapse {{border?'van-hairline--top-bottom':''}}">
<slot></slot>
</view>

1
vant/collapse/index.wxss Normal file
View File

@@ -0,0 +1 @@
@import "../area/index.wxss";

5
vant/common/color.js Normal file
View File

@@ -0,0 +1,5 @@
Object.defineProperty(exports, "__esModule", {
value: !0
});
exports.RED = "#f44", exports.BLUE = "#1989fa", exports.GREEN = "#07c160";

44
vant/common/component.js Normal file
View File

@@ -0,0 +1,44 @@
function e(e, s, a) {
return s in e ? Object.defineProperty(e, s, {
value: a,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[s] = a, e;
}
function s(e, s, a) {
Object.keys(a).forEach(function(t) {
e[t] && (s[a[t]] = e[t]);
});
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.VantComponent = void 0;
var a = require("../mixins/basic"), t = require("../mixins/observer/index");
exports.VantComponent = function() {
var r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, o = {};
s(r, o, {
data: "data",
props: "properties",
mixins: "behaviors",
methods: "methods",
beforeCreate: "created",
created: "attached",
mounted: "ready",
relations: "relations",
destroyed: "detached",
classes: "externalClasses"
});
var n = r.relation;
n && (o.relations = Object.assign(o.relations || {}, e({}, "../" + n.name + "/index", n))),
o.externalClasses = o.externalClasses || [], o.externalClasses.push("custom-class"),
o.behaviors = o.behaviors || [], o.behaviors.push(a.basic), r.field && o.behaviors.push("wx://form-field"),
o.options = {
multipleSlots: !0,
addGlobalClass: !0
}, (0, t.observe)(r, o), Component(o);
};

34
vant/common/utils.js Normal file
View File

@@ -0,0 +1,34 @@
function t(t) {
return void 0 !== t && null !== t;
}
function n(t) {
return /^\d+(\.\d+)?$/.test(t);
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
return typeof t;
} : function(t) {
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
};
exports.isDef = t, exports.isObj = function(t) {
var n = void 0 === t ? "undefined" : e(t);
return null !== t && ("object" === n || "function" === n);
}, exports.isNumber = n, exports.range = function(t, n, e) {
return Math.min(Math.max(t, n), e);
}, exports.nextTick = function(t) {
setTimeout(function() {
t();
}, 1e3 / 30);
}, exports.getSystemInfoSync = function() {
return null == o && (o = wx.getSystemInfoSync()), o;
}, exports.addUnit = function(e) {
if (t(e)) return e = String(e), n(e) ? e + "px" : e;
};
var o = null;

View File

@@ -0,0 +1,238 @@
function e(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n, e;
}
function t(e) {
return (0, s.isDef)(e) && !isNaN(new Date(e).getTime());
}
function n(e, t, n) {
return Math.min(Math.max(e, t), n);
}
function a(e) {
return ("00" + e).slice(-2);
}
function r(e, t) {
for (var n = -1, a = Array(e); ++n < e; ) a[n] = t(n);
return a;
}
function u(e) {
if (e) {
for (;isNaN(parseInt(e, 10)); ) e = e.slice(1);
return parseInt(e, 10);
}
}
function i(e, t) {
return 32 - new Date(e, t - 1, 32).getDate();
}
var o = function() {
function e(e, t) {
var n = [], a = !0, r = !1, u = void 0;
try {
for (var i, o = e[Symbol.iterator](); !(a = (i = o.next()).done) && (n.push(i.value),
!t || n.length !== t); a = !0) ;
} catch (e) {
r = !0, u = e;
} finally {
try {
!a && o.return && o.return();
} finally {
if (r) throw u;
}
}
return n;
}
return function(t, n) {
if (Array.isArray(t)) return t;
if (Symbol.iterator in Object(t)) return e(t, n);
throw new TypeError("Invalid attempt to destructure non-iterable instance");
};
}(), m = require("../common/component"), s = require("../common/utils"), l = require("../picker/shared"), c = new Date().getFullYear(), h = function(e, t) {
return t;
};
(0, m.VantComponent)({
classes: [ "active-class", "toolbar-class", "column-class" ],
props: Object.assign({}, l.pickerProps, {
formatter: {
type: Function,
value: h
},
value: null,
type: {
type: String,
value: "datetime"
},
showToolbar: {
type: Boolean,
value: !0
},
minDate: {
type: Number,
value: new Date(c - 10, 0, 1).getTime()
},
maxDate: {
type: Number,
value: new Date(c + 10, 11, 31).getTime()
},
minHour: {
type: Number,
value: 0
},
maxHour: {
type: Number,
value: 23
},
minMinute: {
type: Number,
value: 0
},
maxMinute: {
type: Number,
value: 59
}
}),
data: {
innerValue: Date.now(),
columns: []
},
watch: {
value: function(e) {
var t = this, n = this.data;
(e = this.correctValue(e)) === n.innerValue || this.updateColumnValue(e).then(function() {
t.$emit("input", e);
});
},
type: "updateColumns",
minHour: "updateColumns",
maxHour: "updateColumns",
minMinute: "updateColumns",
maxMinute: "updateColumns"
},
methods: {
getPicker: function() {
if (null == this.picker) {
var e = this.picker = this.selectComponent(".van-datetime-picker"), t = e.setColumnValues;
e.setColumnValues = function() {
for (var n = arguments.length, a = Array(n), r = 0; r < n; r++) a[r] = arguments[r];
return t.apply(e, [].concat(a, [ !1 ]));
};
}
return this.picker;
},
updateColumns: function() {
var e = this.data.formatter, t = void 0 === e ? h : e, n = this.getRanges().map(function(e, n) {
var u = e.type, i = e.range;
return {
values: r(i[1] - i[0] + 1, function(e) {
var n = i[0] + e;
return n = "year" === u ? "" + n : a(n), t(u, n);
})
};
});
return this.set({
columns: n
});
},
getRanges: function() {
var e = this.data;
if ("time" === e.type) return [ {
type: "hour",
range: [ e.minHour, e.maxHour ]
}, {
type: "minute",
range: [ e.minMinute, e.maxMinute ]
} ];
var t = this.getBoundary("max", e.innerValue), n = t.maxYear, a = t.maxDate, r = t.maxMonth, u = t.maxHour, i = t.maxMinute, o = this.getBoundary("min", e.innerValue), m = o.minYear, s = o.minDate, l = [ {
type: "year",
range: [ m, n ]
}, {
type: "month",
range: [ o.minMonth, r ]
}, {
type: "day",
range: [ s, a ]
}, {
type: "hour",
range: [ o.minHour, u ]
}, {
type: "minute",
range: [ o.minMinute, i ]
} ];
return "date" === e.type && l.splice(3, 2), "year-month" === e.type && l.splice(2, 3),
l;
},
correctValue: function(e) {
var r = this.data, u = "time" !== r.type;
if (u && !t(e) ? e = r.minDate : u || e || (e = a(r.minHour) + ":00"), !u) {
var i = e.split(":"), m = o(i, 2), s = m[0], l = m[1];
return s = a(n(s, r.minHour, r.maxHour)), l = a(n(l, r.minMinute, r.maxMinute)),
s + ":" + l;
}
return e = Math.max(e, r.minDate), e = Math.min(e, r.maxDate);
},
getBoundary: function(t, n) {
var a, r = new Date(n), u = new Date(this.data[t + "Date"]), o = u.getFullYear(), m = 1, s = 1, l = 0, c = 0;
return "max" === t && (m = 12, s = i(r.getFullYear(), r.getMonth() + 1), l = 23,
c = 59), r.getFullYear() === o && (m = u.getMonth() + 1, r.getMonth() + 1 === m && (s = u.getDate(),
r.getDate() === s && (l = u.getHours(), r.getHours() === l && (c = u.getMinutes())))),
a = {}, e(a, t + "Year", o), e(a, t + "Month", m), e(a, t + "Date", s), e(a, t + "Hour", l),
e(a, t + "Minute", c), a;
},
onCancel: function() {
this.$emit("cancel");
},
onConfirm: function() {
this.$emit("confirm", this.data.innerValue);
},
onChange: function() {
var e = this, t = this.data, n = void 0, a = this.getPicker();
if ("time" === t.type) {
var r = a.getIndexes();
n = r[0] + t.minHour + ":" + (r[1] + t.minMinute);
} else {
var o = a.getValues(), m = u(o[0]), s = u(o[1]), l = i(m, s), c = u(o[2]);
"year-month" === t.type && (c = 1), c = c > l ? l : c;
var h = 0, p = 0;
"datetime" === t.type && (h = u(o[3]), p = u(o[4])), n = new Date(m, s - 1, c, h, p);
}
n = this.correctValue(n), this.updateColumnValue(n).then(function() {
e.$emit("input", n), e.$emit("change", a);
});
},
updateColumnValue: function(e) {
var t = this, n = [], r = this.data, u = r.type, i = r.formatter, o = void 0 === i ? h : i, m = this.getPicker();
if ("time" === u) {
var s = e.split(":");
n = [ o("hour", s[0]), o("minute", s[1]) ];
} else {
var l = new Date(e);
n = [ o("year", "" + l.getFullYear()), o("month", a(l.getMonth() + 1)) ], "date" === u && n.push(o("day", a(l.getDate()))),
"datetime" === u && n.push(o("day", a(l.getDate())), o("hour", a(l.getHours())), o("minute", a(l.getMinutes())));
}
return this.set({
innerValue: e
}).then(function() {
return t.updateColumns();
}).then(function() {
return m.setValues(n);
});
}
},
created: function() {
var e = this, t = this.correctValue(this.data.value);
this.updateColumnValue(t).then(function() {
e.$emit("input", t);
});
}
});

View File

@@ -0,0 +1,14 @@
{
"component": true,
"usingComponents": {
"van-picker": "../picker/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"
}
}

View File

@@ -0,0 +1 @@
<van-picker activeClass="active-class" bind:cancel="onCancel" bind:change="onChange" bind:confirm="onConfirm" cancelButtonText="{{cancelButtonText}}" class="van-datetime-picker" columnClass="column-class" columns="{{columns}}" confirmButtonText="{{confirmButtonText}}" itemHeight="{{itemHeight}}" showToolbar="{{showToolbar}}" title="{{title}}" toolbarClass="toolbar-class" visibleItemCount="{{visibleItemCount}}"></van-picker>

View File

@@ -0,0 +1 @@
@import "../area/index.wxss";

54
vant/dialog/dialog.js Normal file
View File

@@ -0,0 +1,54 @@
function e() {
var e = getCurrentPages();
return e[e.length - 1];
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var t = [], n = function n(o) {
return o = Object.assign({}, n.currentOptions, o), o.html = -1 != o.message.indexOf("<"),
new Promise(function(n, s) {
var c = (o.context || e()).selectComponent(o.selector);
delete o.selector, c ? (c.set(Object.assign({
onCancel: s,
onConfirm: n
}, o)), t.push(c)) : console.warn("未找到 van-dialog 节点,请确认 selector 及 context 是否正确");
});
};
n.defaultOptions = {
show: !0,
title: "",
message: "",
zIndex: 2e4,
overlay: !0,
className: "",
asyncClose: !1,
messageAlign: "",
transition: "scale",
selector: "#van-dialog",
confirmButtonText: "确认",
cancelButtonText: "取消",
showConfirmButton: !0,
showCancelButton: !1,
closeOnClickOverlay: !1,
confirmButtonOpenType: ""
}, n.alert = n, n.confirm = function(e) {
return n(Object.assign({
showCancelButton: !0
}, e));
}, n.close = function() {
t.forEach(function(e) {
e.close();
}), t = [];
}, n.stopLoading = function() {
t.forEach(function(e) {
e.stopLoading();
});
}, n.setDefaultOptions = function(e) {
Object.assign(n.currentOptions, e);
}, n.resetDefaultOptions = function() {
n.currentOptions = Object.assign({}, n.defaultOptions);
}, n.resetDefaultOptions(), exports.default = n;

99
vant/dialog/index.js Normal file
View File

@@ -0,0 +1,99 @@
function n(n, e, o) {
return e in n ? Object.defineProperty(n, e, {
value: o,
enumerable: !0,
configurable: !0,
writable: !0
}) : n[e] = o, n;
}
var e = require("../common/component"), o = require("../mixins/button"), t = require("../mixins/open-type");
(0, e.VantComponent)({
mixins: [ o.button, t.openType ],
props: {
show: Boolean,
title: String,
message: String,
useSlot: Boolean,
className: String,
asyncClose: Boolean,
messageAlign: String,
showCancelButton: Boolean,
closeOnClickOverlay: Boolean,
confirmButtonOpenType: String,
zIndex: {
type: Number,
value: 2e4
},
confirmButtonText: {
type: String,
value: "确认"
},
cancelButtonText: {
type: String,
value: "取消"
},
showConfirmButton: {
type: Boolean,
value: !0
},
overlay: {
type: Boolean,
value: !0
},
transition: {
type: String,
value: "scale"
},
closable: {
type: Boolean,
value: !1
}
},
data: {
loading: {
confirm: !1,
cancel: !1
}
},
watch: {
show: function(n) {
!n && this.stopLoading();
}
},
methods: {
onConfirm: function() {
this.handleAction("confirm");
},
onCancel: function() {
this.handleAction("cancel");
},
onClickOverlay: function() {
this.onClose("overlay");
},
handleAction: function(e) {
this.data.asyncClose && this.set(n({}, "loading." + e, !0)), this.onClose(e);
},
close: function() {
this.set({
show: !1
});
},
stopLoading: function() {
this.set({
loading: {
confirm: !1,
cancel: !1
}
});
},
onClose: function(n) {
this.data.asyncClose || this.close(), this.$emit("close", n), this.$emit(n, {
dialog: this
});
var e = this.data["confirm" === n ? "onConfirm" : "onCancel"];
e && e(this);
}
}
});

13
vant/dialog/index.json Normal file
View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"van-popup": "../popup/index",
"van-button": "../button/index",
"forview": "/utils/forview/index",
"van-loading": "/vant/loading/index",
"van-dialog": "/vant/dialog/index",
"van-icon": "/vant/icon/index",
"van-tab": "/vant/tab/index",
"van-tabs": "/vant/tabs/index"
}
}

18
vant/dialog/index.wxml Normal file
View File

@@ -0,0 +1,18 @@
<van-popup bind:close="onClickOverlay" closable="{{closable}}" closeOnClickOverlay="{{closeOnClickOverlay}}" customClass="van-dialog {{className}}" overlay="{{overlay}}" show="{{show}}" transition="{{transition}}" zIndex="{{zIndex}}">
<view class="van-dialog__header {{message||useSlot?'':'van-dialog--isolated'}}" wx:if="{{title}}">
{{title}}
</view>
<slot wx:if="{{useSlot}}"></slot>
<view class="van-dialog__message {{title?'van-dialog__message--has-title':''}} {{messageAlign?'van-dialog__message--'+messageAlign:''}}" wx:elif="{{message}}">
<rich-text nodes="{{message}}" wx:if="{{html}}"></rich-text>
<text wx:else>{{message}}</text>
</view>
<view class="van-hairline--top van-dialog__footer">
<van-button bind:click="onCancel" class="van-dialog__button van-hairline--right" customClass="van-dialog__cancel" loading="{{loading.cancel}}" size="large" wx:if="{{showCancelButton}}">
{{cancelButtonText}}
</van-button>
<van-button appParameter="{{appParameter}}" bind:click="onConfirm" bindcontact="bindContact" binderror="bindError" bindgetphonenumber="bindGetPhoneNumber" bindgetuserinfo="bindGetUserInfo" bindlaunchapp="bindLaunchApp" bindopensetting="bindOpenSetting" businessId="{{businessId}}" class="van-dialog__button" customClass="van-dialog__confirm" lang="{{lang}}" loading="{{loading.confirm}}" openType="{{confirmButtonOpenType}}" sendMessageImg="{{sendMessageImg}}" sendMessagePath="{{sendMessagePath}}" sendMessageTitle="{{sendMessageTitle}}" sessionFrom="{{sessionFrom}}" showMessageCard="{{showMessageCard}}" size="large" wx:if="{{showConfirmButton}}">
{{confirmButtonText}}
</van-button>
</view>
</van-popup>

68
vant/dialog/index.wxss Normal file
View File

@@ -0,0 +1,68 @@
@import "../area/index.wxss";
.van-dialog {
width: 85%;
overflow: hidden;
font-size: 16px;
background-color: #fff;
border-radius: 4px;
}
.van-dialog__header {
padding-top: 21px;
font-weight: 500;
text-align: center;
}
.van-dialog__header--isolated {
padding: 25px 0;
}
.van-dialog__message {
max-height: 60vh;
padding: 10px 15px;
overflow-y: auto;
font-size: 14px;
line-height: 20px;
text-align: center;
-webkit-overflow-scrolling: touch;
}
.van-dialog__message--has-title {
padding-top: 12px;
color: #7d7e80;
}
.van-dialog__message--left {
text-align: left;
}
.van-dialog__message--right {
text-align: right;
}
.van-dialog__footer {
display: flex;
}
.van-dialog__button {
flex: 1;
}
.van-dialog__cancel,.van-dialog__confirm {
border: 0!important;
}
.van-dialog__confirm {
color: #1989fa!important;
}
.van-dialog-bounce-enter {
opacity: 0;
transform: translate3d(-50%,-50%,0) scale(.7);
}
.van-dialog-bounce-leave-active {
opacity: 0;
transform: translate3d(-50%,-50%,0) scale(.9);
}

150
vant/field/index.js Normal file
View File

@@ -0,0 +1,150 @@
(0, require("../common/component").VantComponent)({
field: !0,
classes: [ "input-class", "right-icon-class" ],
props: {
size: String,
icon: String,
label: String,
toggle: Boolean,
error: Boolean,
fixed: Boolean,
focus: Boolean,
center: Boolean,
isLink: Boolean,
leftIcon: String,
rightIcon: String,
disabled: Boolean,
autosize: Boolean,
readonly: Boolean,
required: Boolean,
password: Boolean,
iconClass: String,
clearable: Boolean,
inputAlign: String,
inputClass: String,
customClass: String,
customStyle: String,
confirmType: String,
confirmHold: Boolean,
errorMessage: String,
placeholder: String,
placeholderStyle: String,
errorMessageAlign: String,
showConfirmBar: {
type: Boolean,
value: !0
},
adjustPosition: {
type: Boolean,
value: !0
},
cursorSpacing: {
type: Number,
value: 50
},
maxlength: {
type: Number,
value: -1
},
type: {
type: String,
value: "text"
},
border: {
type: Boolean,
value: !0
},
titleWidth: {
type: String,
value: "78px"
},
hidden: {
type: Boolean,
value: !1
}
},
data: {
showClear: !1
},
beforeCreate: function() {
this.focused = !1, this.set({
placeholder: 1
});
},
created: function() {
this.data.placeholder && this.set({
placeholder: this.data.placeholder.replace(/<br>/g, "\n")
}), "textarea" == this.data.type && this.data.value && this.set({
value: this.data.value.replace(/\\n/g, "\n").replace(/\\t/g, "\t")
});
},
methods: {
onLoad: function() {},
onInput: function(e) {
var t = this, a = (e.detail || {}).value, o = void 0 === a ? "" : a;
this.set({
value: o,
showClear: this.getShowClear(o)
}, function() {
t.emitChange(o);
});
},
onFocus: function(e) {
var t = e.detail || {}, a = t.value, o = void 0 === a ? "" : a, i = t.height, n = void 0 === i ? 0 : i;
this.$emit("focus", {
value: o,
height: n
}), this.focused = !0, this.blurFromClear = !1, this.set({
showClear: this.getShowClear()
});
},
onBlur: function(e) {
var t = this, a = e.detail || {}, o = a.value, i = void 0 === o ? "" : o, n = a.cursor, l = void 0 === n ? 0 : n;
this.$emit("blur", {
value: i,
cursor: l
}), this.focused = !1;
var r = this.getShowClear();
this.data.value === i ? this.set({
showClear: r
}) : this.blurFromClear || this.set({
value: i,
showClear: r
}, function() {
t.emitChange(i);
});
},
onClickIcon: function() {
this.$emit("click-icon");
},
getShowClear: function(e) {
return e = void 0 === e ? this.data.value : e, this.data.clearable && this.focused && e && !this.data.readonly;
},
onClear: function() {
var e = this;
wx.showModal({
title: "提示",
content: "确定清空当前输入框内容吗?",
success: function(t) {
t.confirm && (e.blurFromClear = !0, e.set({
value: "",
showClear: e.getShowClear("")
}, function() {
e.emitChange(""), e.$emit("clear", "");
}));
}
});
},
onConfirm: function() {
this.$emit("confirm", this.data.value);
},
emitChange: function(e) {
var t = this.data.name, a = this.data.label;
this.$emit("input", e), this.$emit("change", {
name: t,
label: a,
value: e
});
}
}
});

14
vant/field/index.json Normal file
View File

@@ -0,0 +1,14 @@
{
"component": true,
"usingComponents": {
"van-cell": "../cell/index",
"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"
}
}

29
vant/field/index.wxml Normal file
View File

@@ -0,0 +1,29 @@
<van-cell border="{{border}}" center="{{center}}" customClass="van-field" customStyle="{{customStyle}}" hidden="{{hidden}}" icon="{{leftIcon}}" isLink="{{isLink}}" required="{{required}}" size="{{size}}" title="{{label}}" titleWidth="{{titleWidth}}">
<slot name="left-icon" slot="icon"></slot>
<slot name="label" slot="title"></slot>
<view class="van-field__body {{type==='textarea'?'van-field__body--textarea':''}}">
<block wx:if="{{type==='textarea'}}">
<view class="input-class {{utils.bem( 'field__input',[ inputAlign,{disabled:disabled,error:error} ] )}} {{inputClass||''}}" wx:if="{{toggle}}">
{{value}}
<text class="{{utils.bem( 'field__placeholder',{error:error} )}}" style="{{placeholderStyle}}" wx:if="{{value==null||value.length===0}}">{{placeholder}}</text>
</view>
<textarea adjustPosition="{{adjustPosition}}" autoHeight="{{autosize}}" bind:blur="onBlur" bind:confirm="onConfirm" bind:focus="onFocus" bindinput="onInput" class="input-class {{utils.bem( 'field__input',[ inputAlign,{disabled:disabled,error:error} ] )}} {{inputClass||''}}" cursorSpacing="{{cursorSpacing}}" disabled="{{disabled||readonly}}" fixed="{{fixed}}" focus="{{focus}}" maxlength="{{maxlength}}" showConfirmBar="{{showConfirmBar}}" value="{{value}}" wx:else>
<text class="{{utils.bem( 'field__placeholder',{error:error} )}}" style="{{placeholderStyle}}" wx:if="{{value==null||value.length===0}}">{{placeholder}}</text>
</textarea>
</block>
<input adjustPosition="{{adjustPosition}}" bind:blur="onBlur" bind:confirm="onConfirm" bind:focus="onFocus" bindinput="onInput" class="input-class {{utils.bem( 'field__input',[ inputAlign,{disabled:disabled,error:error} ] )}} {{inputClass||''}}" confirmHold="{{confirmHold}}" confirmType="{{confirmType}}" cursorSpacing="{{cursorSpacing}}" disabled="{{disabled||readonly}}" focus="{{focus}}" maxlength="{{maxlength}}" password="{{password||type==='password'}}" placeholder="{{placeholder}}" placeholderClass="{{error?'van-field__placeholder--error':'van-field__placeholder'}}" placeholderStyle="{{placeholderStyle}}" type="{{type}}" value="{{value}}" wx:else></input>
<van-icon bindtouchstart="onClear" class="van-field__clear-root van-field__icon-root" name="clear" size="16px" wx:if="{{showClear}}"></van-icon>
<view bind:tap="onClickIcon" class="van-field__icon-container">
<van-icon class="van-field__icon-root {{iconClass}}" customClass="right-icon-class" name="{{rightIcon||icon}}" size="16px" wx:if="{{rightIcon||icon}}"></van-icon>
<slot name="right-icon"></slot>
<slot name="icon"></slot>
</view>
<view class="van-field__button">
<slot name="button"></slot>
</view>
</view>
<view class="van-field__error-message {{utils.bem( 'field__error',[ errorMessageAlign,{disabled:disabled,error:error} ] )}}" wx:if="{{errorMessage}}">
{{errorMessage}}
</view>
</van-cell>
<wxs module="utils" src="../wxs/utils.wxs" />

104
vant/field/index.wxss Normal file
View File

@@ -0,0 +1,104 @@
@import "../area/index.wxss";
.van-field__body {
display: flex;
align-items: center;
}
.van-field__body--textarea {
min-height: 24px;
}
.van-field__input {
position: relative;
display: block;
width: 100%;
height: 24px;
min-height: 24px;
padding: 0;
margin: 0;
line-height: inherit;
color: #333;
text-align: left;
background-color: initial;
border: 0;
box-sizing: border-box;
resize: none;
}
.van-field__input--disabled {
color: #999;
background-color: initial;
opacity: 1;
}
.van-field__input--center {
text-align: center;
}
.van-field__input--right {
text-align: right;
}
.van-field__placeholder {
position: absolute;
top: 0;
left: 0;
color: #999;
pointer-events: none;
}
.van-field__placeholder--error {
color: #f44;
}
.van-field__icon-root {
display: flex;
min-height: 24px;
align-items: center;
}
.van-field__clear-root,.van-field__icon-container {
padding: 0 10px;
margin-right: -10px;
line-height: inherit;
vertical-align: middle;
}
.van-field__button,.van-field__clear-root,.van-field__icon-container {
flex-shrink: 0;
}
.van-field__clear-root {
color: #c9c9c9;
}
.van-field__icon-container {
color: #999;
}
.van-field__icon-container:empty {
display: none;
}
.van-field__button {
padding-left: 10px;
}
.van-field__button:empty {
display: none;
}
.van-field__error-message {
font-size: 12px;
color: #f44;
text-align: left;
}
.van-field__error-message--center {
text-align: center;
}
.van-field__error-message--right {
text-align: right;
}

View File

@@ -0,0 +1,37 @@
var t = require("../common/component"), i = require("../mixins/link"), n = require("../mixins/button"), e = require("../mixins/open-type");
(0, t.VantComponent)({
mixins: [ i.link, n.button, e.openType ],
relation: {
type: "ancestor",
name: "goods-action",
linked: function(t) {
this.parent = t;
}
},
props: {
text: String,
color: String,
loading: Boolean,
disabled: Boolean,
type: {
type: String,
value: "danger"
}
},
mounted: function() {
this.updateStyle();
},
methods: {
onClick: function(t) {
this.$emit("click", t.detail), this.jumpLink();
},
updateStyle: function() {
var t = this.parent.children, i = void 0 === t ? [] : t, n = i.indexOf(this);
this.setData({
isFirst: 0 === n,
isLast: n === i.length - 1
});
}
}
});

View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"van-button": "../button/index",
"forview": "/utils/forview/index",
"van-loading": "/vant/loading/index",
"van-dialog": "/vant/dialog/index",
"van-icon": "/vant/icon/index",
"van-popup": "/vant/popup/index",
"van-tab": "/vant/tab/index",
"van-tabs": "/vant/tabs/index"
}
}

View File

@@ -0,0 +1,4 @@
<van-button square appParameter="{{appParameter}}" bind:click="onClick" bindcontact="bindContact" binderror="bindError" bindgetphonenumber="bindGetPhoneNumber" bindgetuserinfo="bindGetUserInfo" bindlaunchapp="bindLaunchApp" bindopensetting="bindOpenSetting" businessId="{{businessId}}" color="{{color}}" customClass="{{utils.bem( 'goods-action-button',[ type,{first:isFirst,last:isLast} ] )}}" disabled="{{disabled}}" id="{{id}}" lang="{{lang}}" loading="{{loading}}" openType="{{openType}}" sendMessageImg="{{sendMessageImg}}" sendMessagePath="{{sendMessagePath}}" sendMessageTitle="{{sendMessageTitle}}" sessionFrom="{{sessionFrom}}" showMessageCard="{{showMessageCard}}" type="{{type}}">
{{text}}
</van-button>
<wxs module="utils" src="../wxs/utils.wxs" />

View File

@@ -0,0 +1,45 @@
@import "../area/index.wxss";
.van-goods-action-button {
border: none!important;
height: 40px!important;
height: var(--goods-action-button-height,40px)!important;
font-weight: 500!important;
font-weight: var(--font-weight-bold,500)!important;
line-height: 40px!important;
line-height: var(--goods-action-button-height,40px)!important;
}
.van-goods-action-button--first {
display: block!important;
margin-left: 5px;
border-top-left-radius: 20px!important;
border-top-left-radius: var(--goods-action-button-border-radius,20px)!important;
border-bottom-left-radius: 20px!important;
border-bottom-left-radius: var(--goods-action-button-border-radius,20px)!important;
}
.van-goods-action-button--last {
display: block!important;
margin-right: 5px;
border-top-right-radius: 20px!important;
border-top-right-radius: var(--goods-action-button-border-radius,20px)!important;
border-bottom-right-radius: 20px!important;
border-bottom-right-radius: var(--goods-action-button-border-radius,20px)!important;
}
.van-goods-action-button--warning {
background: linear-gradient(90deg,#ffd01e,#ff8917);
background: var(--goods-action-button-warning-color,linear-gradient(90deg,#ffd01e,#ff8917));
}
.van-goods-action-button--danger {
background: linear-gradient(90deg,#ff6034,#ee0a24);
background: var(--goods-action-button-danger-color,linear-gradient(90deg,#ff6034,#ee0a24));
}
@media (max-width:321px) {
.van-goods-action-button {
font-size: 13px;
}
}

View File

@@ -0,0 +1,19 @@
var i = require("../common/component"), n = require("../mixins/link"), e = require("../mixins/button"), o = require("../mixins/open-type");
(0, i.VantComponent)({
classes: [ "icon-class", "text-class" ],
mixins: [ n.link, e.button, o.openType ],
props: {
text: String,
dot: Boolean,
info: String,
icon: String,
disabled: Boolean,
loading: Boolean
},
methods: {
onClick: function(i) {
this.$emit("click", i.detail), this.jumpLink();
}
}
});

View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-button": "../button/index",
"forview": "/utils/forview/index",
"van-loading": "/vant/loading/index",
"van-dialog": "/vant/dialog/index",
"van-popup": "/vant/popup/index",
"van-tab": "/vant/tab/index",
"van-tabs": "/vant/tabs/index"
}
}

View File

@@ -0,0 +1,7 @@
<van-button square appParameter="{{appParameter}}" bind:click="onClick" bindcontact="bindContact" binderror="bindError" bindgetphonenumber="bindGetPhoneNumber" bindgetuserinfo="bindGetUserInfo" bindlaunchapp="bindLaunchApp" bindopensetting="bindOpenSetting" businessId="{{businessId}}" customClass="van-goods-action-icon" disabled="{{disabled}}" id="{{id}}" lang="{{lang}}" loading="{{loading}}" openType="{{openType}}" sendMessageImg="{{sendMessageImg}}" sendMessagePath="{{sendMessagePath}}" sendMessageTitle="{{sendMessageTitle}}" sessionFrom="{{sessionFrom}}" showMessageCard="{{showMessageCard}}" size="large">
<view class="van-goods-action-icon__content">
<van-icon class="van-goods-action-icon__icon" customClass="icon-class" dot="{{dot}}" info="{{info}}" name="{{icon}}" size="20px" wx:if="{{icon}}"></van-icon>
<slot name="icon"></slot>
<text class="text-class">{{text}}</text>
</view>
</van-button>

View File

@@ -0,0 +1,23 @@
@import "../area/index.wxss";
.van-goods-action-icon {
border: none!important;
width: 50px!important;
width: var(--goods-action-icon-height,50px)!important;
}
.van-goods-action-icon__content {
display: flex;
flex-direction: column;
justify-content: center;
height: 100%;
line-height: 1;
font-size: 10px;
font-size: var(--goods-action-icon-font-size,10px);
color: #646566;
color: var(--goods-action-icon-text-color,#646566);
}
.van-goods-action-icon__icon {
margin-bottom: 4px;
}

View File

@@ -0,0 +1,23 @@
(0, require("../common/component").VantComponent)({
relation: {
type: "descendant",
name: "goods-action-button",
linked: function(n) {
this.children.push(n);
},
unlinked: function(n) {
this.children = this.children.filter(function(e) {
return e !== n;
});
}
},
beforeCreate: function() {
this.children = [];
},
props: {
safeAreaInsetBottom: {
type: Boolean,
value: !0
}
}
});

View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"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"
}
}

View File

@@ -0,0 +1,4 @@
<view class="custom-class {{utils.bem( 'goods-action',{safe:safeAreaInsetBottom} )}}">
<slot></slot>
</view>
<wxs module="utils" src="../wxs/utils.wxs" />

View File

@@ -0,0 +1,17 @@
@import "../area/index.wxss";
.van-goods-action {
z-index: 999;
position: fixed;
right: 0;
bottom: 0;
left: 0;
display: flex;
align-items: center;
background-color: #fff;
background-color: var(--goods-action-background-color,#fff);
}
.van-goods-action--safe {
padding-bottom: env(safe-area-inset-bottom);
}

18
vant/icon/index.js Normal file
View File

@@ -0,0 +1,18 @@
(0, require("../common/component").VantComponent)({
props: {
info: null,
name: String,
size: String,
color: String,
customStyle: String,
classPrefix: {
type: String,
value: "van-icon"
}
},
methods: {
onClick: function() {
this.$emit("click");
}
}
});

14
vant/icon/index.json Normal file
View File

@@ -0,0 +1,14 @@
{
"component": true,
"usingComponents": {
"van-info": "../info/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"
}
}

5
vant/icon/index.wxml Normal file
View File

@@ -0,0 +1,5 @@
<view bind:tap="onClick" class="custom-class {{classPrefix}} {{utils.isSrc(name)?'van-icon--image':classPrefix+'-'+name}}" style="{{color?'color: '+color+';':''}}{{size?'font-size: '+size+';':''}}{{customStyle}}">
<van-info customClass="van-icon__info" info="{{info}}" wx:if="{{info!==null}}"></van-info>
<image class="van-icon__image" src="{{name}}" wx:if="{{utils.isSrc(name)}}"></image>
</view>
<wxs module="utils" src="../wxs/utils.wxs" />

1279
vant/icon/index.wxss Normal file

File diff suppressed because one or more lines are too long

6
vant/info/index.js Normal file
View File

@@ -0,0 +1,6 @@
(0, require("../common/component").VantComponent)({
props: {
info: null,
customStyle: String
}
});

13
vant/info/index.json Normal file
View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"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"
}
}

1
vant/info/index.wxml Normal file
View File

@@ -0,0 +1 @@
<view class="custom-class van-info" style="{{customStyle}}" wx:if="{{info!==null}}">{{info}}</view>

22
vant/info/index.wxss Normal file
View File

@@ -0,0 +1,22 @@
@import "../area/index.wxss";
.van-info {
position: absolute;
top: -8px;
right: 0;
min-width: 16px;
padding: 0 3px;
font-family: PingFang SC,Helvetica Neue,Arial,sans-serif;
font-size: 12px;
font-weight: 500;
line-height: 14px;
color: #fff;
text-align: center;
white-space: nowrap;
background-color: #f44;
border: 1px solid #fff;
border-radius: 16px;
transform: translateX(50%);
box-sizing: border-box;
transform-origin: 100%;
}

16
vant/loading/index.js Normal file
View File

@@ -0,0 +1,16 @@
(0, require("../common/component").VantComponent)({
props: {
size: {
type: String,
value: "30px"
},
type: {
type: String,
value: "circular"
},
color: {
type: String,
value: "#c9c9c9"
}
}
});

13
vant/loading/index.json Normal file
View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"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"
}
}

5
vant/loading/index.wxml Normal file
View File

@@ -0,0 +1,5 @@
<view class="van-loading custom-class" style="width: {{size}}; height: {{size}}">
<view class="van-loading__spinner van-loading__spinner--{{type}}" style="color: {{color}};">
<view class="van-loading__dot" wx:if="{{type==='spinner'}}" wx:for="item in 12" wx:key="index"></view>
</view>
</view>

128
vant/loading/index.wxss Normal file
View File

@@ -0,0 +1,128 @@
@import "../area/index.wxss";
.van-loading {
z-index: 0;
line-height: 0;
vertical-align: middle;
}
.van-loading,.van-loading__spinner {
position: relative;
display: inline-block;
}
.van-loading__spinner {
z-index: -1;
width: 100%;
height: 100%;
box-sizing: border-box;
animation: van-rotate .8s linear infinite;
}
.van-loading__spinner--spinner {
animation-timing-function: steps(12);
}
.van-loading__spinner--circular {
border-radius: 100%;
border: 1px solid transparent;
border-top-color: initial;
}
.van-loading__dot {
top: 0;
left: 0;
width: 100%;
height: 100%;
position: absolute;
}
.van-loading__dot:before {
width: 2px;
height: 25%;
content: " ";
display: block;
margin: 0 auto;
border-radius: 40%;
background-color: currentColor;
}
.van-loading__dot:first-of-type {
opacity: 1;
transform: rotate(30deg);
}
.van-loading__dot:nth-of-type(2) {
opacity: .9375;
transform: rotate(60deg);
}
.van-loading__dot:nth-of-type(3) {
opacity: .875;
transform: rotate(90deg);
}
.van-loading__dot:nth-of-type(4) {
opacity: .8125;
transform: rotate(120deg);
}
.van-loading__dot:nth-of-type(5) {
opacity: .75;
transform: rotate(150deg);
}
.van-loading__dot:nth-of-type(6) {
opacity: .6875;
transform: rotate(180deg);
}
.van-loading__dot:nth-of-type(7) {
opacity: .625;
transform: rotate(210deg);
}
.van-loading__dot:nth-of-type(8) {
opacity: .5625;
transform: rotate(240deg);
}
.van-loading__dot:nth-of-type(9) {
opacity: .5;
transform: rotate(270deg);
}
.van-loading__dot:nth-of-type(10) {
opacity: .4375;
transform: rotate(300deg);
}
.van-loading__dot:nth-of-type(11) {
opacity: .375;
transform: rotate(330deg);
}
.van-loading__dot:nth-of-type(12) {
opacity: .3125;
transform: rotate(1turn);
}
@-webkit-keyframes van-rotate {
0% {
transform: rotate(0deg);
}
to {
transform: rotate(1turn);
}
}
@keyframes van-rotate {
0% {
transform: rotate(0deg);
}
to {
transform: rotate(1turn);
}
}

19
vant/mixins/basic.js Normal file
View File

@@ -0,0 +1,19 @@
Object.defineProperty(exports, "__esModule", {
value: !0
});
exports.basic = Behavior({
methods: {
$emit: function() {
this.triggerEvent.apply(this, arguments);
},
getRect: function(e, t) {
var r = this;
return new Promise(function(i) {
wx.createSelectorQuery().in(r)[t ? "selectAll" : "select"](e).boundingClientRect(function(e) {
t && Array.isArray(e) && e.length && i(e), !t && e && i(e);
}).exec();
});
}
}
});

22
vant/mixins/button.js Normal file
View File

@@ -0,0 +1,22 @@
Object.defineProperty(exports, "__esModule", {
value: !0
});
exports.button = Behavior({
externalClasses: [ "hover-class" ],
properties: {
id: String,
lang: {
type: String,
value: "en"
},
businessId: Number,
sessionFrom: String,
sendMessageTitle: String,
sendMessagePath: String,
sendMessageImg: String,
showMessageCard: Boolean,
appParameter: String,
ariaLabel: String
}
});

21
vant/mixins/link.js Normal file
View File

@@ -0,0 +1,21 @@
Object.defineProperty(exports, "__esModule", {
value: !0
});
exports.link = Behavior({
properties: {
url: String,
linkType: {
type: String,
value: "navigateTo"
}
},
methods: {
jumpLink: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "url", t = this.data[e];
t && wx[this.data.linkType]({
url: t
});
}
}
});

View File

@@ -0,0 +1,37 @@
function t(t, e) {
return new Promise(function(i) {
t.setData(e, i);
});
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
exports.behavior = Behavior({
created: function() {
var t = this;
if (this.$options) {
var e = {}, i = this.$options().computed, o = Object.keys(i);
this.calcComputed = function() {
var n = {};
return o.forEach(function(o) {
var s = i[o].call(t);
e[o] !== s && (e[o] = n[o] = s);
}), n;
};
}
},
attached: function() {
this.set();
},
methods: {
set: function(e, i) {
var o = this, n = [];
return e && n.push(t(this, e)), this.calcComputed && n.push(t(this, this.calcComputed())),
Promise.all(n).then(function(t) {
return i && "function" == typeof i && i.call(o), t;
});
}
}
});

View File

@@ -0,0 +1,21 @@
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.observe = function(o, t) {
var s = o.watch, i = o.computed;
if (t.behaviors.push(e.behavior), s) {
var p = t.properties || {};
Object.keys(s).forEach(function(e) {
if (e in p) {
var r = p[e];
null !== r && "type" in r || (r = {
type: r
}), r.observer = s[e], p[e] = r;
}
}), t.properties = p;
}
i && (t.methods = t.methods || {}, t.methods.$options = function() {
return o;
}, t.properties && (0, r.observeProps)(t.properties));
};
var e = require("./behavior"), r = require("./props");

View File

@@ -0,0 +1,14 @@
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.observeProps = function(e) {
e && Object.keys(e).forEach(function(t) {
var r = e[t];
null !== r && "type" in r || (r = {
type: r
});
var s = r.observer;
r.observer = function() {
s && ("string" == typeof s && (s = this[s]), s.apply(this, arguments)), this.set();
}, e[t] = r;
});
};

29
vant/mixins/open-type.js Normal file
View File

@@ -0,0 +1,29 @@
Object.defineProperty(exports, "__esModule", {
value: !0
});
exports.openType = Behavior({
properties: {
openType: String
},
methods: {
bindGetUserInfo: function(e) {
this.$emit("getuserinfo", e.detail);
},
bindContact: function(e) {
this.$emit("contact", e.detail);
},
bindGetPhoneNumber: function(e) {
this.$emit("getphonenumber", e.detail);
},
bindError: function(e) {
this.$emit("error", e.detail);
},
bindLaunchApp: function(e) {
this.$emit("launchapp", e.detail);
},
bindOpenSetting: function(e) {
this.$emit("opensetting", e.detail);
}
}
});

46
vant/mixins/safe-area.js Normal file
View File

@@ -0,0 +1,46 @@
function e() {
return new Promise(function(e, s) {
null != t ? e(t) : wx.getSystemInfo({
success: function(s) {
var n = s.model, o = s.screenHeight, a = s.statusBarHeight, r = /iphone x/i.test(n), i = /iPhone11/i.test(n) && 812 === o;
e(t = {
isIPhoneX: r || i,
statusBarHeight: a
});
},
fail: s
});
});
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var t = null;
exports.safeArea = function() {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, s = t.safeAreaInsetBottom, n = void 0 === s || s, o = t.safeAreaInsetTop, a = void 0 !== o && o;
return Behavior({
properties: {
safeAreaInsetTop: {
type: Boolean,
value: a
},
safeAreaInsetBottom: {
type: Boolean,
value: n
}
},
created: function() {
var t = this;
e().then(function(e) {
var s = e.isIPhoneX, n = e.statusBarHeight;
t.set({
isIPhoneX: s,
statusBarHeight: n
});
});
}
});
};

Some files were not shown because too many files have changed in this diff Show More