diff --git a/dist/action-sheet/index.js b/dist/action-sheet/index.js
index 28bf57fa..225b463a 100644
--- a/dist/action-sheet/index.js
+++ b/dist/action-sheet/index.js
@@ -1,7 +1,7 @@
import { VantComponent } from '../common/component';
-import { iphonex } from '../mixins/iphonex';
+import { safeArea } from '../mixins/safe-area';
VantComponent({
- mixins: [iphonex],
+ mixins: [safeArea()],
props: {
show: Boolean,
title: String,
diff --git a/dist/button/index.js b/dist/button/index.js
index 001cdf73..0fb37987 100644
--- a/dist/button/index.js
+++ b/dist/button/index.js
@@ -10,6 +10,7 @@ VantComponent({
round: Boolean,
square: Boolean,
loading: Boolean,
+ hairline: Boolean,
disabled: Boolean,
loadingText: String,
type: {
diff --git a/dist/button/index.wxml b/dist/button/index.wxml
index 3d56d448..0b0763ad 100644
--- a/dist/button/index.wxml
+++ b/dist/button/index.wxml
@@ -2,7 +2,7 @@
diff --git a/dist/icon/index.wxss b/dist/icon/index.wxss
index 5e8d4452..5a4ec661 100644
--- a/dist/icon/index.wxss
+++ b/dist/icon/index.wxss
@@ -1 +1 @@
-@import '../common/index.wxss';@font-face{font-style:normal;font-weight:400;font-family:vant-icon;src:url(https://img.yzcdn.cn/vant/vant-icon-c13a1e.woff2) format("woff2"),url(https://img.yzcdn.cn/vant/vant-icon-c13a1e.woff) format("woff"),url(https://img.yzcdn.cn/vant/vant-icon-c13a1e.ttf) format("truetype")}.van-icon{position:relative;font:normal normal normal 14px/1 vant-icon;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased}.van-icon,.van-icon:before{display:inline-block}.van-icon-add-o:before{content:"\F000"}.van-icon-add-square:before{content:"\F001"}.van-icon-add:before{content:"\F002"}.van-icon-after-sale:before{content:"\F003"}.van-icon-aim:before{content:"\F004"}.van-icon-alipay:before{content:"\F005"}.van-icon-apps-o:before{content:"\F006"}.van-icon-arrow-down:before{content:"\F007"}.van-icon-arrow-left:before{content:"\F008"}.van-icon-arrow-up:before{content:"\F009"}.van-icon-arrow:before{content:"\F00A"}.van-icon-ascending:before{content:"\F00B"}.van-icon-audio:before{content:"\F00C"}.van-icon-award-o:before{content:"\F00D"}.van-icon-award:before{content:"\F00E"}.van-icon-bag-o:before{content:"\F00F"}.van-icon-bag:before{content:"\F010"}.van-icon-balance-list-o:before{content:"\F011"}.van-icon-balance-list:before{content:"\F012"}.van-icon-balance-o:before{content:"\F013"}.van-icon-balance-pay:before{content:"\F014"}.van-icon-bar-chart-o:before{content:"\F015"}.van-icon-bars:before{content:"\F016"}.van-icon-bell:before{content:"\F017"}.van-icon-bill-o:before{content:"\F018"}.van-icon-bill:before{content:"\F019"}.van-icon-birthday-cake-o:before{content:"\F01A"}.van-icon-bookmark-o:before{content:"\F01B"}.van-icon-bookmark:before{content:"\F01C"}.van-icon-browsing-history-o:before{content:"\F01D"}.van-icon-browsing-history:before{content:"\F01E"}.van-icon-brush-o:before{content:"\F01F"}.van-icon-bulb-o:before{content:"\F020"}.van-icon-bullhorn-o:before{content:"\F021"}.van-icon-calender-o:before{content:"\F022"}.van-icon-card:before{content:"\F023"}.van-icon-cart-circle-o:before{content:"\F024"}.van-icon-cart-circle:before{content:"\F025"}.van-icon-cart-o:before{content:"\F026"}.van-icon-cart:before{content:"\F027"}.van-icon-cash-back-record:before{content:"\F028"}.van-icon-cash-on-deliver:before{content:"\F029"}.van-icon-cashier-o:before{content:"\F02A"}.van-icon-certificate:before{content:"\F02B"}.van-icon-chart-trending-o:before{content:"\F02C"}.van-icon-chat-o:before{content:"\F02D"}.van-icon-chat:before{content:"\F02E"}.van-icon-checked:before{content:"\F02F"}.van-icon-circle:before{content:"\F030"}.van-icon-clear:before{content:"\F031"}.van-icon-clock-o:before{content:"\F032"}.van-icon-clock:before{content:"\F033"}.van-icon-close:before{content:"\F034"}.van-icon-closed-eye:before{content:"\F035"}.van-icon-cluster-o:before{content:"\F036"}.van-icon-cluster:before{content:"\F037"}.van-icon-column:before{content:"\F038"}.van-icon-comment-circle-o:before{content:"\F039"}.van-icon-comment-o:before{content:"\F03A"}.van-icon-comment:before{content:"\F03B"}.van-icon-completed:before{content:"\F03C"}.van-icon-contact:before{content:"\F03D"}.van-icon-coupon-o:before{content:"\F03E"}.van-icon-coupon:before{content:"\F03F"}.van-icon-credit-pay:before{content:"\F040"}.van-icon-cross:before{content:"\F041"}.van-icon-debit-pay:before{content:"\F042"}.van-icon-delete:before{content:"\F043"}.van-icon-descending:before{content:"\F044"}.van-icon-description:before{content:"\F045"}.van-icon-desktop-o:before{content:"\F046"}.van-icon-diamond-o:before{content:"\F047"}.van-icon-diamond:before{content:"\F048"}.van-icon-discount:before{content:"\F049"}.van-icon-ecard-pay:before{content:"\F04A"}.van-icon-edit:before{content:"\F04B"}.van-icon-ellipsis:before{content:"\F04C"}.van-icon-empty:before{content:"\F04D"}.van-icon-envelop-o:before{content:"\F04E"}.van-icon-exchange:before{content:"\F04F"}.van-icon-expand-o:before{content:"\F050"}.van-icon-expand:before{content:"\F051"}.van-icon-eye-o:before{content:"\F052"}.van-icon-eye:before{content:"\F053"}.van-icon-fail:before{content:"\F054"}.van-icon-failure:before{content:"\F055"}.van-icon-filter-o:before{content:"\F056"}.van-icon-fire-o:before{content:"\F057"}.van-icon-fire:before{content:"\F058"}.van-icon-flag-o:before{content:"\F059"}.van-icon-flower-o:before{content:"\F05A"}.van-icon-free-postage:before{content:"\F05B"}.van-icon-friends-o:before{content:"\F05C"}.van-icon-friends:before{content:"\F05D"}.van-icon-gem-o:before{content:"\F05E"}.van-icon-gem:before{content:"\F05F"}.van-icon-gift-card-o:before{content:"\F060"}.van-icon-gift-card:before{content:"\F061"}.van-icon-gift-o:before{content:"\F062"}.van-icon-gift:before{content:"\F063"}.van-icon-gold-coin-o:before{content:"\F064"}.van-icon-gold-coin:before{content:"\F065"}.van-icon-goods-collect-o:before{content:"\F066"}.van-icon-goods-collect:before{content:"\F067"}.van-icon-graphic:before{content:"\F068"}.van-icon-home-o:before{content:"\F069"}.van-icon-hot-o:before{content:"\F06A"}.van-icon-hot-sale-o:before{content:"\F06B"}.van-icon-hot-sale:before{content:"\F06C"}.van-icon-hot:before{content:"\F06D"}.van-icon-hotel-o:before{content:"\F06E"}.van-icon-idcard:before{content:"\F06F"}.van-icon-info-o:before{content:"\F070"}.van-icon-info:before{content:"\F071"}.van-icon-invition:before{content:"\F072"}.van-icon-label-o:before{content:"\F073"}.van-icon-label:before{content:"\F074"}.van-icon-like-o:before{content:"\F075"}.van-icon-like:before{content:"\F076"}.van-icon-live:before{content:"\F077"}.van-icon-location-o:before{content:"\F078"}.van-icon-location:before{content:"\F079"}.van-icon-lock:before{content:"\F07A"}.van-icon-logistics:before{content:"\F07B"}.van-icon-manager-o:before{content:"\F07C"}.van-icon-manager:before{content:"\F07D"}.van-icon-map-marked:before{content:"\F07E"}.van-icon-medel-o:before{content:"\F07F"}.van-icon-medel:before{content:"\F080"}.van-icon-more-o:before{content:"\F081"}.van-icon-more:before{content:"\F082"}.van-icon-music-o:before{content:"\F083"}.van-icon-new-arrival-o:before{content:"\F084"}.van-icon-new-arrival:before{content:"\F085"}.van-icon-new-o:before{content:"\F086"}.van-icon-new:before{content:"\F087"}.van-icon-newspaper-o:before{content:"\F088"}.van-icon-notes-o:before{content:"\F089"}.van-icon-orders-o:before{content:"\F08A"}.van-icon-other-pay:before{content:"\F08B"}.van-icon-paid:before{content:"\F08C"}.van-icon-passed:before{content:"\F08D"}.van-icon-pause-circle-o:before{content:"\F08E"}.van-icon-pause-circle:before{content:"\F08F"}.van-icon-pause:before{content:"\F090"}.van-icon-peer-pay:before{content:"\F091"}.van-icon-pending-payment:before{content:"\F092"}.van-icon-phone-circle-o:before{content:"\F093"}.van-icon-phone-o:before{content:"\F094"}.van-icon-phone:before{content:"\F095"}.van-icon-photo-o:before{content:"\F096"}.van-icon-photo:before{content:"\F097"}.van-icon-photograph:before{content:"\F098"}.van-icon-play-circle-o:before{content:"\F099"}.van-icon-play-circle:before{content:"\F09A"}.van-icon-play:before{content:"\F09B"}.van-icon-plus:before{content:"\F09C"}.van-icon-point-gift-o:before{content:"\F09D"}.van-icon-point-gift:before{content:"\F09E"}.van-icon-points:before{content:"\F09F"}.van-icon-printer:before{content:"\F0A0"}.van-icon-qr-invalid:before{content:"\F0A1"}.van-icon-qr:before{content:"\F0A2"}.van-icon-question-o:before{content:"\F0A3"}.van-icon-question:before{content:"\F0A4"}.van-icon-records:before{content:"\F0A5"}.van-icon-refund-o:before{content:"\F0A6"}.van-icon-replay:before{content:"\F0A7"}.van-icon-scan:before{content:"\F0A8"}.van-icon-search:before{content:"\F0A9"}.van-icon-send-gift-o:before{content:"\F0AA"}.van-icon-send-gift:before{content:"\F0AB"}.van-icon-service-o:before{content:"\F0AC"}.van-icon-service:before{content:"\F0AD"}.van-icon-setting-o:before{content:"\F0AE"}.van-icon-setting:before{content:"\F0AF"}.van-icon-share:before{content:"\F0B0"}.van-icon-shop-collect-o:before{content:"\F0B1"}.van-icon-shop-collect:before{content:"\F0B2"}.van-icon-shop-o:before{content:"\F0B3"}.van-icon-shop:before{content:"\F0B4"}.van-icon-shopping-cart-o:before{content:"\F0B5"}.van-icon-shopping-cart:before{content:"\F0B6"}.van-icon-shrink:before{content:"\F0B7"}.van-icon-sign:before{content:"\F0B8"}.van-icon-smile-comment-o:before{content:"\F0B9"}.van-icon-smile-comment:before{content:"\F0BA"}.van-icon-smile-o:before{content:"\F0BB"}.van-icon-star-o:before{content:"\F0BC"}.van-icon-star:before{content:"\F0BD"}.van-icon-stop-circle-o:before{content:"\F0BE"}.van-icon-stop-circle:before{content:"\F0BF"}.van-icon-stop:before{content:"\F0C0"}.van-icon-success:before{content:"\F0C1"}.van-icon-thumb-circle-o:before{content:"\F0C2"}.van-icon-todo-list-o:before{content:"\F0C3"}.van-icon-todo-list:before{content:"\F0C4"}.van-icon-tosend:before{content:"\F0C5"}.van-icon-tv-o:before{content:"\F0C6"}.van-icon-umbrella-circle:before{content:"\F0C7"}.van-icon-underway-o:before{content:"\F0C8"}.van-icon-underway:before{content:"\F0C9"}.van-icon-upgrade:before{content:"\F0CA"}.van-icon-user-circle-o:before{content:"\F0CB"}.van-icon-user-o:before{content:"\F0CC"}.van-icon-video-o:before{content:"\F0CD"}.van-icon-video:before{content:"\F0CE"}.van-icon-vip-card-o:before{content:"\F0CF"}.van-icon-vip-card:before{content:"\F0D0"}.van-icon-volume-o:before{content:"\F0D1"}.van-icon-volume:before{content:"\F0D2"}.van-icon-wap-home:before{content:"\F0D3"}.van-icon-wap-nav:before{content:"\F0D4"}.van-icon-warn-o:before{content:"\F0D5"}.van-icon-warning-o:before{content:"\F0D6"}.van-icon-weapp-nav:before{content:"\F0D7"}.van-icon-wechat:before{content:"\F0D8"}.van-icon-youzan-shield:before{content:"\F0D9"}.van-icon--image{width:1em;height:1em}.van-icon--image image{position:absolute;top:0;right:0;bottom:0;left:0;max-width:100%;max-height:100%;margin:auto}.van-icon__info{z-index:1}
\ No newline at end of file
+@import '../common/index.wxss';@font-face{font-style:normal;font-weight:400;font-family:vant-icon;src:url(https://img.yzcdn.cn/vant/vant-icon-29f643.woff2) format("woff2"),url(https://img.yzcdn.cn/vant/vant-icon-29f643.woff) format("woff"),url(https://img.yzcdn.cn/vant/vant-icon-29f643.ttf) format("truetype")}.van-icon{position:relative;font:normal normal normal 14px/1 vant-icon;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased}.van-icon,.van-icon:before{display:inline-block}.van-icon-add-o:before{content:"\F000"}.van-icon-add-square:before{content:"\F001"}.van-icon-add:before{content:"\F002"}.van-icon-after-sale:before{content:"\F003"}.van-icon-aim:before{content:"\F004"}.van-icon-alipay:before{content:"\F005"}.van-icon-apps-o:before{content:"\F006"}.van-icon-arrow-down:before{content:"\F007"}.van-icon-arrow-left:before{content:"\F008"}.van-icon-arrow-up:before{content:"\F009"}.van-icon-arrow:before{content:"\F00A"}.van-icon-ascending:before{content:"\F00B"}.van-icon-audio:before{content:"\F00C"}.van-icon-award-o:before{content:"\F00D"}.van-icon-award:before{content:"\F00E"}.van-icon-bag-o:before{content:"\F00F"}.van-icon-bag:before{content:"\F010"}.van-icon-balance-list-o:before{content:"\F011"}.van-icon-balance-list:before{content:"\F012"}.van-icon-balance-o:before{content:"\F013"}.van-icon-balance-pay:before{content:"\F014"}.van-icon-bar-chart-o:before{content:"\F015"}.van-icon-bars:before{content:"\F016"}.van-icon-bell:before{content:"\F017"}.van-icon-bill-o:before{content:"\F018"}.van-icon-bill:before{content:"\F019"}.van-icon-birthday-cake-o:before{content:"\F01A"}.van-icon-bookmark-o:before{content:"\F01B"}.van-icon-bookmark:before{content:"\F01C"}.van-icon-browsing-history-o:before{content:"\F01D"}.van-icon-browsing-history:before{content:"\F01E"}.van-icon-brush-o:before{content:"\F01F"}.van-icon-bulb-o:before{content:"\F020"}.van-icon-bullhorn-o:before{content:"\F021"}.van-icon-calender-o:before{content:"\F022"}.van-icon-card:before{content:"\F023"}.van-icon-cart-circle-o:before{content:"\F024"}.van-icon-cart-circle:before{content:"\F025"}.van-icon-cart-o:before{content:"\F026"}.van-icon-cart:before{content:"\F027"}.van-icon-cash-back-record:before{content:"\F028"}.van-icon-cash-on-deliver:before{content:"\F029"}.van-icon-cashier-o:before{content:"\F02A"}.van-icon-certificate:before{content:"\F02B"}.van-icon-chart-trending-o:before{content:"\F02C"}.van-icon-chat-o:before{content:"\F02D"}.van-icon-chat:before{content:"\F02E"}.van-icon-checked:before{content:"\F02F"}.van-icon-circle:before{content:"\F030"}.van-icon-clear:before{content:"\F031"}.van-icon-clock-o:before{content:"\F032"}.van-icon-clock:before{content:"\F033"}.van-icon-close:before{content:"\F034"}.van-icon-closed-eye:before{content:"\F035"}.van-icon-cluster-o:before{content:"\F036"}.van-icon-cluster:before{content:"\F037"}.van-icon-column:before{content:"\F038"}.van-icon-comment-circle-o:before{content:"\F039"}.van-icon-comment-o:before{content:"\F03A"}.van-icon-comment:before{content:"\F03B"}.van-icon-completed:before{content:"\F03C"}.van-icon-contact:before{content:"\F03D"}.van-icon-coupon-o:before{content:"\F03E"}.van-icon-coupon:before{content:"\F03F"}.van-icon-credit-pay:before{content:"\F040"}.van-icon-cross:before{content:"\F041"}.van-icon-debit-pay:before{content:"\F042"}.van-icon-delete:before{content:"\F043"}.van-icon-descending:before{content:"\F044"}.van-icon-description:before{content:"\F045"}.van-icon-desktop-o:before{content:"\F046"}.van-icon-diamond-o:before{content:"\F047"}.van-icon-diamond:before{content:"\F048"}.van-icon-discount:before{content:"\F049"}.van-icon-ecard-pay:before{content:"\F04A"}.van-icon-edit:before{content:"\F04B"}.van-icon-ellipsis:before{content:"\F04C"}.van-icon-empty:before{content:"\F04D"}.van-icon-envelop-o:before{content:"\F04E"}.van-icon-exchange:before{content:"\F04F"}.van-icon-expand-o:before{content:"\F050"}.van-icon-expand:before{content:"\F051"}.van-icon-eye-o:before{content:"\F052"}.van-icon-eye:before{content:"\F053"}.van-icon-fail:before{content:"\F054"}.van-icon-failure:before{content:"\F055"}.van-icon-filter-o:before{content:"\F056"}.van-icon-fire-o:before{content:"\F057"}.van-icon-fire:before{content:"\F058"}.van-icon-flag-o:before{content:"\F059"}.van-icon-flower-o:before{content:"\F05A"}.van-icon-free-postage:before{content:"\F05B"}.van-icon-friends-o:before{content:"\F05C"}.van-icon-friends:before{content:"\F05D"}.van-icon-gem-o:before{content:"\F05E"}.van-icon-gem:before{content:"\F05F"}.van-icon-gift-card-o:before{content:"\F060"}.van-icon-gift-card:before{content:"\F061"}.van-icon-gift-o:before{content:"\F062"}.van-icon-gift:before{content:"\F063"}.van-icon-gold-coin-o:before{content:"\F064"}.van-icon-gold-coin:before{content:"\F065"}.van-icon-goods-collect-o:before{content:"\F066"}.van-icon-goods-collect:before{content:"\F067"}.van-icon-graphic:before{content:"\F068"}.van-icon-home-o:before{content:"\F069"}.van-icon-hot-o:before{content:"\F06A"}.van-icon-hot-sale-o:before{content:"\F06B"}.van-icon-hot-sale:before{content:"\F06C"}.van-icon-hot:before{content:"\F06D"}.van-icon-hotel-o:before{content:"\F06E"}.van-icon-idcard:before{content:"\F06F"}.van-icon-info-o:before{content:"\F070"}.van-icon-info:before{content:"\F071"}.van-icon-invition:before{content:"\F072"}.van-icon-label-o:before{content:"\F073"}.van-icon-label:before{content:"\F074"}.van-icon-like-o:before{content:"\F075"}.van-icon-like:before{content:"\F076"}.van-icon-live:before{content:"\F077"}.van-icon-location-o:before{content:"\F078"}.van-icon-location:before{content:"\F079"}.van-icon-lock:before{content:"\F07A"}.van-icon-logistics:before{content:"\F07B"}.van-icon-manager-o:before{content:"\F07C"}.van-icon-manager:before{content:"\F07D"}.van-icon-map-marked:before{content:"\F07E"}.van-icon-medel-o:before{content:"\F07F"}.van-icon-medel:before{content:"\F080"}.van-icon-more-o:before{content:"\F081"}.van-icon-more:before{content:"\F082"}.van-icon-music-o:before{content:"\F083"}.van-icon-new-arrival-o:before{content:"\F084"}.van-icon-new-arrival:before{content:"\F085"}.van-icon-new-o:before{content:"\F086"}.van-icon-new:before{content:"\F087"}.van-icon-newspaper-o:before{content:"\F088"}.van-icon-notes-o:before{content:"\F089"}.van-icon-orders-o:before{content:"\F08A"}.van-icon-other-pay:before{content:"\F08B"}.van-icon-paid:before{content:"\F08C"}.van-icon-passed:before{content:"\F08D"}.van-icon-pause-circle-o:before{content:"\F08E"}.van-icon-pause-circle:before{content:"\F08F"}.van-icon-pause:before{content:"\F090"}.van-icon-peer-pay:before{content:"\F091"}.van-icon-pending-payment:before{content:"\F092"}.van-icon-phone-circle-o:before{content:"\F093"}.van-icon-phone-o:before{content:"\F094"}.van-icon-phone:before{content:"\F095"}.van-icon-photo-o:before{content:"\F096"}.van-icon-photo:before{content:"\F097"}.van-icon-photograph:before{content:"\F098"}.van-icon-play-circle-o:before{content:"\F099"}.van-icon-play-circle:before{content:"\F09A"}.van-icon-play:before{content:"\F09B"}.van-icon-plus:before{content:"\F09C"}.van-icon-point-gift-o:before{content:"\F09D"}.van-icon-point-gift:before{content:"\F09E"}.van-icon-points:before{content:"\F09F"}.van-icon-printer:before{content:"\F0A0"}.van-icon-qr-invalid:before{content:"\F0A1"}.van-icon-qr:before{content:"\F0A2"}.van-icon-question-o:before{content:"\F0A3"}.van-icon-question:before{content:"\F0A4"}.van-icon-records:before{content:"\F0A5"}.van-icon-refund-o:before{content:"\F0A6"}.van-icon-replay:before{content:"\F0A7"}.van-icon-scan:before{content:"\F0A8"}.van-icon-search:before{content:"\F0A9"}.van-icon-send-gift-o:before{content:"\F0AA"}.van-icon-send-gift:before{content:"\F0AB"}.van-icon-service-o:before{content:"\F0AC"}.van-icon-service:before{content:"\F0AD"}.van-icon-setting-o:before{content:"\F0AE"}.van-icon-setting:before{content:"\F0AF"}.van-icon-share:before{content:"\F0B0"}.van-icon-shop-collect-o:before{content:"\F0B1"}.van-icon-shop-collect:before{content:"\F0B2"}.van-icon-shop-o:before{content:"\F0B3"}.van-icon-shop:before{content:"\F0B4"}.van-icon-shopping-cart-o:before{content:"\F0B5"}.van-icon-shopping-cart:before{content:"\F0B6"}.van-icon-shrink:before{content:"\F0B7"}.van-icon-sign:before{content:"\F0B8"}.van-icon-smile-comment-o:before{content:"\F0B9"}.van-icon-smile-comment:before{content:"\F0BA"}.van-icon-smile-o:before{content:"\F0BB"}.van-icon-star-o:before{content:"\F0BC"}.van-icon-star:before{content:"\F0BD"}.van-icon-stop-circle-o:before{content:"\F0BE"}.van-icon-stop-circle:before{content:"\F0BF"}.van-icon-stop:before{content:"\F0C0"}.van-icon-success:before{content:"\F0C1"}.van-icon-thumb-circle-o:before{content:"\F0C2"}.van-icon-todo-list-o:before{content:"\F0C3"}.van-icon-todo-list:before{content:"\F0C4"}.van-icon-tosend:before{content:"\F0C5"}.van-icon-tv-o:before{content:"\F0C6"}.van-icon-umbrella-circle:before{content:"\F0C7"}.van-icon-underway-o:before{content:"\F0C8"}.van-icon-underway:before{content:"\F0C9"}.van-icon-upgrade:before{content:"\F0CA"}.van-icon-user-circle-o:before{content:"\F0CB"}.van-icon-user-o:before{content:"\F0CC"}.van-icon-video-o:before{content:"\F0CD"}.van-icon-video:before{content:"\F0CE"}.van-icon-vip-card-o:before{content:"\F0CF"}.van-icon-vip-card:before{content:"\F0D0"}.van-icon-volume-o:before{content:"\F0D1"}.van-icon-volume:before{content:"\F0D2"}.van-icon-wap-home:before{content:"\F0D3"}.van-icon-wap-nav:before{content:"\F0D4"}.van-icon-warn-o:before{content:"\F0D5"}.van-icon-warning-o:before{content:"\F0D6"}.van-icon-weapp-nav:before{content:"\F0D7"}.van-icon-wechat:before{content:"\F0D8"}.van-icon-youzan-shield:before{content:"\F0D9"}.van-icon--image{width:1em;height:1em}.van-icon__image{position:absolute;top:0;right:0;bottom:0;left:0;max-width:100%;max-height:100%;margin:auto}.van-icon__info{z-index:1}
\ No newline at end of file
diff --git a/dist/mixins/iphonex.d.ts b/dist/mixins/iphonex.d.ts
deleted file mode 100644
index 67081dbd..00000000
--- a/dist/mixins/iphonex.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export declare const iphonex: void;
diff --git a/dist/mixins/iphonex.js b/dist/mixins/iphonex.js
deleted file mode 100644
index f2885f4c..00000000
--- a/dist/mixins/iphonex.js
+++ /dev/null
@@ -1,32 +0,0 @@
-let isIPhoneX = null;
-function getIsIPhoneX() {
- return new Promise((resolve, reject) => {
- if (isIPhoneX !== null) {
- resolve(isIPhoneX);
- }
- else {
- wx.getSystemInfo({
- success: ({ model, screenHeight }) => {
- const iphoneX = /iphone x/i.test(model);
- const iphoneNew = /iPhone11/i.test(model) && screenHeight === 812;
- isIPhoneX = iphoneX || iphoneNew;
- resolve(isIPhoneX);
- },
- fail: reject
- });
- }
- });
-}
-export const iphonex = Behavior({
- properties: {
- safeAreaInsetBottom: {
- type: Boolean,
- value: true
- }
- },
- created() {
- getIsIPhoneX().then(isIPhoneX => {
- this.set({ isIPhoneX });
- });
- }
-});
diff --git a/dist/mixins/safe-area.d.ts b/dist/mixins/safe-area.d.ts
new file mode 100644
index 00000000..31fae45e
--- /dev/null
+++ b/dist/mixins/safe-area.d.ts
@@ -0,0 +1,4 @@
+export declare const safeArea: ({ safeAreaInsetBottom, safeAreaInsetTop }?: {
+ safeAreaInsetBottom?: boolean;
+ safeAreaInsetTop?: boolean;
+}) => void;
diff --git a/dist/mixins/safe-area.js b/dist/mixins/safe-area.js
new file mode 100644
index 00000000..e5026220
--- /dev/null
+++ b/dist/mixins/safe-area.js
@@ -0,0 +1,39 @@
+let cache = null;
+function getSafeArea() {
+ return new Promise((resolve, reject) => {
+ if (cache != null) {
+ resolve(cache);
+ }
+ else {
+ wx.getSystemInfo({
+ success: ({ model, screenHeight, statusBarHeight }) => {
+ const iphoneX = /iphone x/i.test(model);
+ const iphoneNew = /iPhone11/i.test(model) && screenHeight === 812;
+ cache = {
+ isIPhoneX: iphoneX || iphoneNew,
+ statusBarHeight
+ };
+ resolve(cache);
+ },
+ fail: reject
+ });
+ }
+ });
+}
+export const safeArea = ({ safeAreaInsetBottom = true, safeAreaInsetTop = false } = {}) => Behavior({
+ properties: {
+ safeAreaInsetTop: {
+ type: Boolean,
+ value: safeAreaInsetTop
+ },
+ safeAreaInsetBottom: {
+ type: Boolean,
+ value: safeAreaInsetBottom
+ }
+ },
+ created() {
+ getSafeArea().then(({ isIPhoneX, statusBarHeight }) => {
+ this.set({ isIPhoneX, statusBarHeight });
+ });
+ }
+});
diff --git a/dist/nav-bar/index.js b/dist/nav-bar/index.js
index 39af4886..b2aa6ca1 100644
--- a/dist/nav-bar/index.js
+++ b/dist/nav-bar/index.js
@@ -1,5 +1,7 @@
import { VantComponent } from '../common/component';
+import { safeArea } from '../mixins/safe-area';
VantComponent({
+ mixins: [safeArea({ safeAreaInsetTop: true })],
classes: ['title-class'],
props: {
title: String,
@@ -13,7 +15,7 @@ VantComponent({
},
zIndex: {
type: Number,
- value: 1
+ value: 120
}
},
methods: {
diff --git a/dist/nav-bar/index.wxml b/dist/nav-bar/index.wxml
index e1b4fc53..2f235b5a 100644
--- a/dist/nav-bar/index.wxml
+++ b/dist/nav-bar/index.wxml
@@ -1,6 +1,8 @@
+
+
diff --git a/dist/nav-bar/index.wxss b/dist/nav-bar/index.wxss
index 147d2fa4..8f576d3c 100644
--- a/dist/nav-bar/index.wxss
+++ b/dist/nav-bar/index.wxss
@@ -1 +1 @@
-@import '../common/index.wxss';.van-nav-bar{position:relative;height:46px;line-height:46px;text-align:center;background-color:#fff;-webkit-user-select:none;user-select:none}.van-nav-bar__text{display:inline-block;padding:0 15px;margin:0 -15px;color:#1989fa;vertical-align:middle}.van-nav-bar__text--hover{background-color:#f2f3f5}.van-nav-bar__arrow{color:#1989fa;vertical-align:middle}.van-nav-bar__arrow+.van-nav-bar__text{padding-left:25px;margin-left:-20px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;font-size:16px;font-weight:500}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;font-size:14px}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}
\ No newline at end of file
+@import '../common/index.wxss';.van-nav-bar{position:relative;height:44px;line-height:44px;text-align:center;background-color:#fff;-webkit-user-select:none;user-select:none}.van-nav-bar__text{display:inline-block;padding:0 15px;margin:0 -15px;color:#1989fa;vertical-align:middle}.van-nav-bar__text--hover{background-color:#f2f3f5}.van-nav-bar__arrow{color:#1989fa;vertical-align:middle}.van-nav-bar__arrow+.van-nav-bar__text{padding-left:25px;margin-left:-20px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;font-size:16px;font-weight:500}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;font-size:14px}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}
\ No newline at end of file
diff --git a/dist/notify/index.js b/dist/notify/index.js
index 2e50abda..38445dbc 100644
--- a/dist/notify/index.js
+++ b/dist/notify/index.js
@@ -1,6 +1,8 @@
import { VantComponent } from '../common/component';
import { RED } from '../common/color';
+import { safeArea } from '../mixins/safe-area';
VantComponent({
+ mixins: [safeArea()],
props: {
text: String,
color: {
diff --git a/dist/notify/index.wxml b/dist/notify/index.wxml
index e55f859f..4f480eaa 100644
--- a/dist/notify/index.wxml
+++ b/dist/notify/index.wxml
@@ -2,7 +2,8 @@
name="slide-down"
show="{{ show }}"
custom-class="van-notify"
- custom-style="background-color:{{ backgroundColor }}; color: {{ color }}"
+ custom-style="background-color:{{ backgroundColor }}; color: {{ color }};"
>
+
{{ text }}
diff --git a/dist/notify/index.wxss b/dist/notify/index.wxss
index 52e528f6..de9b6203 100644
--- a/dist/notify/index.wxss
+++ b/dist/notify/index.wxss
@@ -1 +1 @@
-@import '../common/index.wxss';.van-notify{position:fixed;top:0;z-index:110;width:100%;padding:6px 15px;font-size:14px;line-height:20px;text-align:center;word-break:break-all;box-sizing:border-box}
\ No newline at end of file
+@import '../common/index.wxss';.van-notify{position:fixed;top:0;z-index:110;width:100%;padding:6px 15px;font-size:14px;line-height:20px;text-align:center;word-break:break-all;box-sizing:border-box}.van-notify__safe-top{height:44px}
\ No newline at end of file
diff --git a/dist/notify/notify.d.ts b/dist/notify/notify.d.ts
index f821e9db..efd46b25 100644
--- a/dist/notify/notify.d.ts
+++ b/dist/notify/notify.d.ts
@@ -1,7 +1,11 @@
declare type NotifyOptions = {
- selector?: string;
+ text: string;
+ color?: string;
+ backgroundColor?: string;
duration?: number;
+ selector?: string;
context?: any;
+ safeAreaInsetTop?: boolean;
};
-export default function Notify(options?: NotifyOptions): void;
+export default function Notify(options: NotifyOptions | string): void;
export {};
diff --git a/dist/notify/notify.js b/dist/notify/notify.js
index ea5153ab..0f6f3e10 100644
--- a/dist/notify/notify.js
+++ b/dist/notify/notify.js
@@ -10,7 +10,7 @@ function getContext() {
const pages = getCurrentPages();
return pages[pages.length - 1];
}
-export default function Notify(options = {}) {
+export default function Notify(options) {
options = Object.assign({}, defaultOptions, parseOptions(options));
const context = options.context || getContext();
const notify = context.selectComponent(options.selector);
diff --git a/dist/popup/index.js b/dist/popup/index.js
index 837dc9f8..2b65812b 100644
--- a/dist/popup/index.js
+++ b/dist/popup/index.js
@@ -1,6 +1,6 @@
import { VantComponent } from '../common/component';
import { transition } from '../mixins/transition';
-import { iphonex } from '../mixins/iphonex';
+import { safeArea } from '../mixins/safe-area';
VantComponent({
classes: [
'enter-class',
@@ -10,7 +10,7 @@ VantComponent({
'leave-active-class',
'leave-to-class'
],
- mixins: [transition(false), iphonex],
+ mixins: [transition(false), safeArea()],
props: {
transition: {
type: String,
diff --git a/dist/popup/index.wxml b/dist/popup/index.wxml
index 6d38e13b..9c53b381 100644
--- a/dist/popup/index.wxml
+++ b/dist/popup/index.wxml
@@ -11,9 +11,10 @@
/>
diff --git a/dist/popup/index.wxss b/dist/popup/index.wxss
index 3e3df103..0f7a49d8 100644
--- a/dist/popup/index.wxss
+++ b/dist/popup/index.wxss
@@ -1 +1 @@
-@import '../common/index.wxss';.van-popup{position:fixed;top:50%;left:50%;max-height:100%;overflow-y:auto;background-color:#fff;box-sizing:border-box;-webkit-animation:ease both;animation:ease both;-webkit-overflow-scrolling:touch;transition-timing-function:ease}.van-popup--center{-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-popup--top{top:0;right:auto;bottom:auto;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--right{top:50%;right:0;bottom:auto;left:auto;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--bottom{top:auto;right:auto;bottom:0;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--left{top:50%;right:auto;bottom:auto;left:0;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--safe{padding-bottom:34px}.van-scale-enter-active,.van-scale-leave-active{transition-property:opacity,-webkit-transform;transition-property:opacity,transform;transition-property:opacity,transform,-webkit-transform}.van-scale-enter,.van-scale-leave-to{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7)}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-center-enter-active,.van-center-leave-active{transition-property:opacity}.van-center-enter,.van-center-leave-to{opacity:0}.van-bottom-enter-active,.van-bottom-leave-active,.van-left-enter-active,.van-left-leave-active,.van-right-enter-active,.van-right-leave-active,.van-top-enter-active,.van-top-leave-active{transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-bottom-enter,.van-bottom-leave-to{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}.van-top-enter,.van-top-leave-to{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}.van-left-enter,.van-left-leave-to{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}.van-right-enter,.van-right-leave-to{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}
\ No newline at end of file
+@import '../common/index.wxss';.van-popup{position:fixed;top:50%;left:50%;max-height:100%;overflow-y:auto;background-color:#fff;box-sizing:border-box;-webkit-animation:ease both;animation:ease both;-webkit-overflow-scrolling:touch;transition-timing-function:ease}.van-popup--center{-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-popup--top{top:0;right:auto;bottom:auto;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--right{top:50%;right:0;bottom:auto;left:auto;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--bottom{top:auto;right:auto;bottom:0;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--left{top:50%;right:auto;bottom:auto;left:0;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--bottom.van-popup--safe{padding-bottom:34px}.van-popup--left .van-popup__safe-top,.van-popup--right .van-popup__safe-top,.van-popup--top .van-popup__safe-top{height:44px}.van-popup--bottom .van-popup__safe-top,.van-popup--center .van-popup__safe-top{padding-top:0!important}.van-scale-enter-active,.van-scale-leave-active{transition-property:opacity,-webkit-transform;transition-property:opacity,transform;transition-property:opacity,transform,-webkit-transform}.van-scale-enter,.van-scale-leave-to{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7)}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-center-enter-active,.van-center-leave-active{transition-property:opacity}.van-center-enter,.van-center-leave-to{opacity:0}.van-bottom-enter-active,.van-bottom-leave-active,.van-left-enter-active,.van-left-leave-active,.van-right-enter-active,.van-right-leave-active,.van-top-enter-active,.van-top-leave-active{transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-bottom-enter,.van-bottom-leave-to{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}.van-top-enter,.van-top-leave-to{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}.van-left-enter,.van-left-leave-to{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}.van-right-enter,.van-right-leave-to{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}
\ No newline at end of file
diff --git a/dist/slider/index.js b/dist/slider/index.js
index 2d8d79ed..d439cd57 100644
--- a/dist/slider/index.js
+++ b/dist/slider/index.js
@@ -47,7 +47,7 @@ VantComponent({
if (this.data.disabled)
return;
this.touchMove(event);
- this.getRect('.van-slider').then(rect => {
+ this.getRect('.van-slider').then((rect) => {
const diff = this.deltaX / rect.width * 100;
this.updateValue(this.startValue + diff, false, true);
});
@@ -60,7 +60,7 @@ VantComponent({
onClick(event) {
if (this.data.disabled)
return;
- this.getRect(rect => {
+ this.getRect('.van-slider').then((rect) => {
const value = (event.detail.x - rect.left) / rect.width * 100;
this.updateValue(value, true);
});
diff --git a/dist/slider/index.wxml b/dist/slider/index.wxml
index e57d1e9c..d30d078b 100644
--- a/dist/slider/index.wxml
+++ b/dist/slider/index.wxml
@@ -1,5 +1,7 @@
+
+
diff --git a/dist/stepper/index.js b/dist/stepper/index.js
index fbf66f35..0f3f4d2e 100644
--- a/dist/stepper/index.js
+++ b/dist/stepper/index.js
@@ -10,6 +10,7 @@ VantComponent({
value: null,
integer: Boolean,
disabled: Boolean,
+ inputWidth: String,
asyncChange: Boolean,
disableInput: Boolean,
min: {
diff --git a/dist/stepper/index.wxml b/dist/stepper/index.wxml
index 923b5545..7d16f4d9 100644
--- a/dist/stepper/index.wxml
+++ b/dist/stepper/index.wxml
@@ -10,6 +10,7 @@
+
-
+
{
- this.setActiveItem();
- });
+ this.children = this.children || [];
+ this.children.push(target);
+ this.setActiveItem();
},
unlinked(target) {
- this.data.items = this.data.items.filter(item => item !== target);
- setTimeout(() => {
- this.setActiveItem();
- });
+ this.children = this.children || [];
+ this.children = this.children.filter(item => item !== target);
+ this.setActiveItem();
}
},
props: {
@@ -30,9 +28,6 @@ VantComponent({
value: 1
}
},
- data: {
- items: []
- },
watch: {
active(active) {
this.currentActive = active;
@@ -44,19 +39,21 @@ VantComponent({
},
methods: {
setActiveItem() {
- this.data.items.forEach((item, index) => {
- item.setActive({
- active: index === this.currentActive,
- color: this.data.activeColor
- });
- });
+ if (!Array.isArray(this.children) || !this.children.length) {
+ return Promise.resolve();
+ }
+ return Promise.all(this.children.map((item, index) => item.setActive({
+ active: index === this.currentActive,
+ color: this.data.activeColor
+ })));
},
onChange(child) {
- const active = this.data.items.indexOf(child);
+ const active = (this.children || []).indexOf(child);
if (active !== this.currentActive && active !== -1) {
- this.$emit('change', active);
this.currentActive = active;
- this.setActiveItem();
+ this.setActiveItem().then(() => {
+ this.$emit('change', active);
+ });
}
}
}
diff --git a/lib/action-sheet/index.js b/lib/action-sheet/index.js
new file mode 100644
index 00000000..63aed39b
--- /dev/null
+++ b/lib/action-sheet/index.js
@@ -0,0 +1,43 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var safe_area_1 = require("../mixins/safe-area");
+component_1.VantComponent({
+ mixins: [safe_area_1.safeArea()],
+ props: {
+ show: Boolean,
+ title: String,
+ cancelText: String,
+ zIndex: {
+ type: Number,
+ value: 100
+ },
+ actions: {
+ type: Array,
+ value: []
+ },
+ overlay: {
+ type: Boolean,
+ value: true
+ },
+ closeOnClickOverlay: {
+ type: Boolean,
+ value: true
+ }
+ },
+ methods: {
+ onSelect: function (event) {
+ var index = event.currentTarget.dataset.index;
+ var item = this.data.actions[index];
+ if (item && !item.disabled && !item.loading) {
+ this.$emit('select', item);
+ }
+ },
+ onCancel: function () {
+ this.$emit('cancel');
+ },
+ onClose: function () {
+ this.$emit('close');
+ }
+ }
+});
diff --git a/lib/action-sheet/index.json b/lib/action-sheet/index.json
new file mode 100644
index 00000000..19bf9891
--- /dev/null
+++ b/lib/action-sheet/index.json
@@ -0,0 +1,8 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index",
+ "van-popup": "../popup/index",
+ "van-loading": "../loading/index"
+ }
+}
diff --git a/lib/action-sheet/index.wxml b/lib/action-sheet/index.wxml
new file mode 100644
index 00000000..5f6d33f8
--- /dev/null
+++ b/lib/action-sheet/index.wxml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+ {{ cancelText }}
+
+
diff --git a/lib/action-sheet/index.wxss b/lib/action-sheet/index.wxss
new file mode 100644
index 00000000..a3087b1b
--- /dev/null
+++ b/lib/action-sheet/index.wxss
@@ -0,0 +1 @@
+@import '../common/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}
\ No newline at end of file
diff --git a/lib/area/index.js b/lib/area/index.js
new file mode 100644
index 00000000..65403818
--- /dev/null
+++ b/lib/area/index.js
@@ -0,0 +1,176 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ classes: ['active-class', 'toolbar-class', 'column-class'],
+ props: {
+ title: String,
+ value: String,
+ loading: Boolean,
+ cancelButtonText: String,
+ confirmButtonText: String,
+ itemHeight: {
+ type: Number,
+ value: 44
+ },
+ visibleItemCount: {
+ type: Number,
+ value: 5
+ },
+ columnsNum: {
+ type: [String, Number],
+ value: 3
+ },
+ areaList: {
+ type: Object,
+ value: {}
+ }
+ },
+ data: {
+ columns: [{ values: [] }, { values: [] }, { values: [] }],
+ displayColumns: [{ values: [] }, { values: [] }, { values: [] }]
+ },
+ watch: {
+ value: function (value) {
+ this.code = value;
+ this.setValues();
+ },
+ areaList: 'setValues',
+ columnsNum: function (value) {
+ this.set({
+ displayColumns: this.data.columns.slice(0, +value)
+ });
+ }
+ },
+ methods: {
+ getPicker: function () {
+ if (this.picker == null) {
+ this.picker = this.selectComponent('.van-area__picker');
+ }
+ return this.picker;
+ },
+ onCancel: function (event) {
+ this.emit('cancel', event.detail);
+ },
+ onConfirm: function (event) {
+ this.emit('confirm', event.detail);
+ },
+ emit: function (type, detail) {
+ detail.values = detail.value;
+ delete detail.value;
+ this.$emit(type, detail);
+ },
+ onChange: function (event) {
+ var _this = this;
+ var _a = event.detail, index = _a.index, picker = _a.picker, value = _a.value;
+ this.code = value[index].code;
+ this.setValues().then(function () {
+ _this.$emit('change', {
+ picker: picker,
+ values: picker.getValues(),
+ index: index
+ });
+ });
+ },
+ getConfig: function (type) {
+ var areaList = this.data.areaList;
+ return (areaList && areaList[type + "_list"]) || {};
+ },
+ getList: function (type, code) {
+ var result = [];
+ if (type !== 'province' && !code) {
+ return result;
+ }
+ var list = this.getConfig(type);
+ result = Object.keys(list).map(function (code) { return ({
+ code: code,
+ name: list[code]
+ }); });
+ if (code) {
+ // oversea code
+ if (code[0] === '9' && type === 'city') {
+ code = '9';
+ }
+ result = result.filter(function (item) { return item.code.indexOf(code) === 0; });
+ }
+ return result;
+ },
+ getIndex: function (type, code) {
+ var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
+ var list = this.getList(type, code.slice(0, compareNum - 2));
+ // oversea code
+ if (code[0] === '9' && type === 'province') {
+ compareNum = 1;
+ }
+ code = code.slice(0, compareNum);
+ for (var i = 0; i < list.length; i++) {
+ if (list[i].code.slice(0, compareNum) === code) {
+ return i;
+ }
+ }
+ return 0;
+ },
+ setValues: function () {
+ var _this = this;
+ var county = this.getConfig('county');
+ var code = this.code || Object.keys(county)[0] || '';
+ var province = this.getList('province');
+ var city = this.getList('city', code.slice(0, 2));
+ var picker = this.getPicker();
+ if (!picker) {
+ return;
+ }
+ var stack = [];
+ stack.push(picker.setColumnValues(0, province, false));
+ stack.push(picker.setColumnValues(1, city, false));
+ if (city.length && code.slice(2, 4) === '00') {
+ ;
+ code = city[0].code;
+ }
+ stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
+ return Promise.all(stack)
+ .catch(function () { })
+ .then(function () {
+ return picker.setIndexes([
+ _this.getIndex('province', code),
+ _this.getIndex('city', code),
+ _this.getIndex('county', code)
+ ]);
+ })
+ .catch(function () { });
+ },
+ getValues: function () {
+ var picker = this.getPicker();
+ return picker ? picker.getValues().filter(function (value) { return !!value; }) : [];
+ },
+ getDetail: function () {
+ var values = this.getValues();
+ var area = {
+ code: '',
+ country: '',
+ province: '',
+ city: '',
+ county: ''
+ };
+ if (!values.length) {
+ return area;
+ }
+ var names = values.map(function (item) { return item.name; });
+ area.code = values[values.length - 1].code;
+ if (area.code[0] === '9') {
+ area.country = names[1] || '';
+ area.province = names[2] || '';
+ }
+ else {
+ area.province = names[0] || '';
+ area.city = names[1] || '';
+ area.county = names[2] || '';
+ }
+ return area;
+ },
+ reset: function () {
+ this.code = '';
+ return this.setValues();
+ }
+ }
+});
diff --git a/lib/area/index.json b/lib/area/index.json
new file mode 100644
index 00000000..a778e91c
--- /dev/null
+++ b/lib/area/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-picker": "../picker/index"
+ }
+}
diff --git a/lib/area/index.wxml b/lib/area/index.wxml
new file mode 100644
index 00000000..60757941
--- /dev/null
+++ b/lib/area/index.wxml
@@ -0,0 +1,18 @@
+
diff --git a/lib/area/index.wxss b/lib/area/index.wxss
new file mode 100644
index 00000000..99694d60
--- /dev/null
+++ b/lib/area/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';
\ No newline at end of file
diff --git a/lib/badge-group/index.js b/lib/badge-group/index.js
new file mode 100644
index 00000000..dce7a51a
--- /dev/null
+++ b/lib/badge-group/index.js
@@ -0,0 +1,51 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var utils_1 = require("../common/utils");
+component_1.VantComponent({
+ relation: {
+ name: 'badge',
+ type: 'descendant',
+ linked: function (target) {
+ this.badges.push(target);
+ this.setActive();
+ },
+ unlinked: function (target) {
+ this.badges = this.badges.filter(function (item) { return item !== target; });
+ this.setActive();
+ }
+ },
+ props: {
+ active: {
+ type: Number,
+ value: 0
+ }
+ },
+ watch: {
+ active: 'setActive'
+ },
+ beforeCreate: function () {
+ this.badges = [];
+ this.currentActive = -1;
+ },
+ methods: {
+ setActive: function (badge) {
+ var active = this.data.active;
+ var badges = this.badges;
+ if (badge && !utils_1.isNumber(badge)) {
+ active = badges.indexOf(badge);
+ }
+ if (active === this.currentActive) {
+ return;
+ }
+ if (this.currentActive !== -1 && badges[this.currentActive]) {
+ this.$emit('change', active);
+ badges[this.currentActive].setActive(false);
+ }
+ if (badges[active]) {
+ badges[active].setActive(true);
+ this.currentActive = active;
+ }
+ }
+ }
+});
diff --git a/lib/badge-group/index.json b/lib/badge-group/index.json
new file mode 100644
index 00000000..467ce294
--- /dev/null
+++ b/lib/badge-group/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/lib/badge-group/index.wxml b/lib/badge-group/index.wxml
new file mode 100644
index 00000000..04a0c8f3
--- /dev/null
+++ b/lib/badge-group/index.wxml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/lib/badge-group/index.wxss b/lib/badge-group/index.wxss
new file mode 100644
index 00000000..5149eabf
--- /dev/null
+++ b/lib/badge-group/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-badge-group{width:85px}
\ No newline at end of file
diff --git a/lib/badge/index.js b/lib/badge/index.js
new file mode 100644
index 00000000..37cb16c6
--- /dev/null
+++ b/lib/badge/index.js
@@ -0,0 +1,24 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ relation: {
+ type: 'ancestor',
+ name: 'badge-group'
+ },
+ props: {
+ info: null,
+ title: String
+ },
+ methods: {
+ onClick: function () {
+ var group = this.getRelationNodes('../badge-group/index')[0];
+ if (group) {
+ group.setActive(this);
+ }
+ },
+ setActive: function (active) {
+ this.set({ active: active });
+ }
+ }
+});
diff --git a/lib/badge/index.json b/lib/badge/index.json
new file mode 100644
index 00000000..bf0ebe00
--- /dev/null
+++ b/lib/badge/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-info": "../info/index"
+ }
+}
diff --git a/lib/badge/index.wxml b/lib/badge/index.wxml
new file mode 100644
index 00000000..3563bdbf
--- /dev/null
+++ b/lib/badge/index.wxml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ {{ title }}
+
+
diff --git a/lib/badge/index.wxss b/lib/badge/index.wxss
new file mode 100644
index 00000000..73cb2c1e
--- /dev/null
+++ b/lib/badge/index.wxss
@@ -0,0 +1 @@
+@import '../common/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;-webkit-user-select:none;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}
\ No newline at end of file
diff --git a/lib/button/index.js b/lib/button/index.js
new file mode 100644
index 00000000..59c454a1
--- /dev/null
+++ b/lib/button/index.js
@@ -0,0 +1,38 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var button_1 = require("../mixins/button");
+var open_type_1 = require("../mixins/open-type");
+component_1.VantComponent({
+ mixins: [button_1.button, open_type_1.openType],
+ classes: ['hover-class', 'loading-class'],
+ props: {
+ plain: Boolean,
+ block: Boolean,
+ round: Boolean,
+ square: Boolean,
+ loading: Boolean,
+ hairline: Boolean,
+ disabled: Boolean,
+ loadingText: String,
+ type: {
+ type: String,
+ value: 'default'
+ },
+ size: {
+ type: String,
+ value: 'normal'
+ },
+ loadingSize: {
+ type: String,
+ value: '20px'
+ }
+ },
+ methods: {
+ onClick: function () {
+ if (!this.data.disabled && !this.data.loading) {
+ this.$emit('click');
+ }
+ }
+ }
+});
diff --git a/lib/button/index.json b/lib/button/index.json
new file mode 100644
index 00000000..cae21702
--- /dev/null
+++ b/lib/button/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-loading": "../loading/index"
+ }
+}
\ No newline at end of file
diff --git a/lib/button/index.wxml b/lib/button/index.wxml
new file mode 100644
index 00000000..0b0763ad
--- /dev/null
+++ b/lib/button/index.wxml
@@ -0,0 +1,39 @@
+
+
+
diff --git a/lib/button/index.wxss b/lib/button/index.wxss
new file mode 100644
index 00000000..e6da32d8
--- /dev/null
+++ b/lib/button/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-button{position:relative;display:inline-block;height:44px;padding:0;font-size:16px;line-height:42px;text-align:center;vertical-align:middle;box-sizing:border-box;border-radius:2px;-webkit-appearance:none;-webkit-text-size-adjust:100%}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;background-color:#000;border:inherit;border-color:#000;border-radius:inherit;content:" ";opacity:0;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#333;background-color:#fff;border:1px solid #eee}.van-button--primary{color:#fff;background-color:#07c160;border:1px solid #07c160}.van-button--info{color:#fff;background-color:#1989fa;border:1px solid #1989fa}.van-button--danger{color:#fff;background-color:#f44;border:1px solid #f44}.van-button--warning{color:#fff;background-color:#ff976a;border:1px solid #ff976a}.van-button--plain{background-color:#fff}.van-button--plain.van-button--primary{color:#07c160}.van-button--plain.van-button--info{color:#1989fa}.van-button--plain.van-button--danger{color:#f44}.van-button--plain.van-button--warning{color:#ff976a}.van-button--large{width:100%;height:50px;line-height:48px}.van-button--normal{padding:0 15px;font-size:14px}.van-button--small{height:30px;min-width:60px;padding:0 8px;font-size:12px;line-height:28px}.van-button--mini{display:inline-block;width:50px;height:22px;font-size:10px;line-height:20px}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:block;width:100%}.van-button--round{border-radius:10em}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5}.van-button__loading-text{margin-left:5px;display:inline-block;vertical-align:middle}.van-button--hairline{border-width:0;padding-top:1px}.van-button--hairline:after{border-width:1px;border-color:inherit;border-radius:4px}.van-button--hairline.van-button--round:after{border-radius:10em}.van-button--hairline.van-button--square:after{border-radius:0}
\ No newline at end of file
diff --git a/lib/card/index.js b/lib/card/index.js
new file mode 100644
index 00000000..47a7d832
--- /dev/null
+++ b/lib/card/index.js
@@ -0,0 +1,40 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var link_1 = require("../mixins/link");
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ classes: [
+ 'num-class',
+ 'desc-class',
+ 'thumb-class',
+ 'title-class',
+ 'price-class',
+ 'origin-price-class',
+ ],
+ mixins: [link_1.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');
+ }
+ }
+});
diff --git a/lib/card/index.json b/lib/card/index.json
new file mode 100644
index 00000000..e9174076
--- /dev/null
+++ b/lib/card/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-tag": "../tag/index"
+ }
+}
diff --git a/lib/card/index.wxml b/lib/card/index.wxml
new file mode 100644
index 00000000..46d9d813
--- /dev/null
+++ b/lib/card/index.wxml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
diff --git a/lib/card/index.wxss b/lib/card/index.wxss
new file mode 100644
index 00000000..6a749258
--- /dev/null
+++ b/lib/card/index.wxss
@@ -0,0 +1 @@
+@import '../common/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:-webkit-flex;display:flex}.van-card__header--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;width:90px;height:90px;margin-right:10px;-webkit-flex:none;flex:none}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%}.van-card__content{position:relative;min-width:0;-webkit-flex:1;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;-webkit-flex:none;flex:none}
\ No newline at end of file
diff --git a/lib/cell-group/index.js b/lib/cell-group/index.js
new file mode 100644
index 00000000..c81ce4bb
--- /dev/null
+++ b/lib/cell-group/index.js
@@ -0,0 +1,12 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ props: {
+ title: String,
+ border: {
+ type: Boolean,
+ value: true
+ }
+ }
+});
diff --git a/lib/cell-group/index.json b/lib/cell-group/index.json
new file mode 100644
index 00000000..32640e0d
--- /dev/null
+++ b/lib/cell-group/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
\ No newline at end of file
diff --git a/lib/cell-group/index.wxml b/lib/cell-group/index.wxml
new file mode 100644
index 00000000..6e0b471d
--- /dev/null
+++ b/lib/cell-group/index.wxml
@@ -0,0 +1,9 @@
+
+ {{ title }}
+
+
+
+
diff --git a/lib/cell-group/index.wxss b/lib/cell-group/index.wxss
new file mode 100644
index 00000000..e0fc603d
--- /dev/null
+++ b/lib/cell-group/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-cell-group__title{font-size:14px;padding:15px 15px 5px;color:#999;line-height:16px}
\ No newline at end of file
diff --git a/lib/cell/index.js b/lib/cell/index.js
new file mode 100644
index 00000000..5a62f45b
--- /dev/null
+++ b/lib/cell/index.js
@@ -0,0 +1,38 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var link_1 = require("../mixins/link");
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ classes: [
+ 'title-class',
+ 'label-class',
+ 'value-class',
+ 'right-icon-class',
+ 'hover-class'
+ ],
+ mixins: [link_1.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,
+ border: {
+ type: Boolean,
+ value: true
+ }
+ },
+ methods: {
+ onClick: function (event) {
+ this.$emit('click', event.detail);
+ this.jumpLink();
+ }
+ }
+});
diff --git a/lib/cell/index.json b/lib/cell/index.json
new file mode 100644
index 00000000..a9ab393a
--- /dev/null
+++ b/lib/cell/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index"
+ }
+}
\ No newline at end of file
diff --git a/lib/cell/index.wxml b/lib/cell/index.wxml
new file mode 100644
index 00000000..44f643d8
--- /dev/null
+++ b/lib/cell/index.wxml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+ {{ title }}
+ {{ label }}
+
+
+
+
+
+ {{ value }}
+
+
+
+
+
+
+
+
diff --git a/lib/cell/index.wxss b/lib/cell/index.wxss
new file mode 100644
index 00000000..a476af17
--- /dev/null
+++ b/lib/cell/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-cell{position:relative;display:-webkit-flex;display:flex;width:100%;padding:10px 15px;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;-webkit-transform-origin:center;transform-origin:center;top:auto;left:15px;right:0;bottom:0;-webkit-transform:scaleY(.5);transform:scaleY(.5);border-bottom:1px solid #eee}.van-cell--borderless:after{display:none}.van-cell-group{background-color:#fff}.van-cell__label{margin-top:3px;font-size:12px;line-height:18px;color:#999}.van-cell__value{overflow:hidden;color:#999;text-align:right;vertical-align:middle}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;height:24px;font-size:16px;-webkit-align-items:center;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{background-color:#f2f3f5}.van-cell--required{overflow:visible}.van-cell--required:before{position:absolute;left:7px;font-size:14px;color:#f44;content:"*"}.van-cell--center{-webkit-align-items: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}
\ No newline at end of file
diff --git a/lib/checkbox-group/index.js b/lib/checkbox-group/index.js
new file mode 100644
index 00000000..4882bec1
--- /dev/null
+++ b/lib/checkbox-group/index.js
@@ -0,0 +1,36 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ field: true,
+ relation: {
+ name: 'checkbox',
+ type: 'descendant',
+ linked: function (target) {
+ var _a = this.data, value = _a.value, disabled = _a.disabled;
+ target.set({
+ value: value.indexOf(target.data.name) !== -1,
+ disabled: disabled || target.data.disabled
+ });
+ }
+ },
+ props: {
+ max: Number,
+ value: Array,
+ disabled: Boolean
+ },
+ watch: {
+ value: function (value) {
+ var children = this.getRelationNodes('../checkbox/index');
+ children.forEach(function (child) {
+ child.set({ value: value.indexOf(child.data.name) !== -1 });
+ });
+ },
+ disabled: function (disabled) {
+ var children = this.getRelationNodes('../checkbox/index');
+ children.forEach(function (child) {
+ child.set({ disabled: disabled || child.data.disabled });
+ });
+ }
+ }
+});
diff --git a/lib/checkbox-group/index.json b/lib/checkbox-group/index.json
new file mode 100644
index 00000000..0a336c08
--- /dev/null
+++ b/lib/checkbox-group/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index"
+ }
+}
diff --git a/lib/checkbox-group/index.wxml b/lib/checkbox-group/index.wxml
new file mode 100644
index 00000000..4fa864ce
--- /dev/null
+++ b/lib/checkbox-group/index.wxml
@@ -0,0 +1 @@
+
diff --git a/lib/checkbox-group/index.wxss b/lib/checkbox-group/index.wxss
new file mode 100644
index 00000000..99694d60
--- /dev/null
+++ b/lib/checkbox-group/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';
\ No newline at end of file
diff --git a/lib/checkbox/index.js b/lib/checkbox/index.js
new file mode 100644
index 00000000..6e4b4bea
--- /dev/null
+++ b/lib/checkbox/index.js
@@ -0,0 +1,69 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ field: true,
+ relation: {
+ name: 'checkbox-group',
+ type: 'ancestor'
+ },
+ classes: ['icon-class', 'label-class'],
+ props: {
+ value: null,
+ disabled: Boolean,
+ useIconSlot: Boolean,
+ checkedColor: String,
+ labelPosition: String,
+ labelDisabled: Boolean,
+ shape: {
+ type: String,
+ value: 'round'
+ }
+ },
+ methods: {
+ emitChange: function (value) {
+ var parent = this.getRelationNodes('../checkbox-group/index')[0];
+ if (parent) {
+ this.setParentValue(parent, value);
+ }
+ else {
+ this.$emit('input', value);
+ this.$emit('change', value);
+ }
+ },
+ toggle: function () {
+ if (!this.data.disabled) {
+ this.emitChange(!this.data.value);
+ }
+ },
+ onClickLabel: function () {
+ if (!this.data.disabled && !this.data.labelDisabled) {
+ this.emitChange(!this.data.value);
+ }
+ },
+ setParentValue: function (parent, value) {
+ var parentValue = parent.data.value.slice();
+ var name = this.data.name;
+ if (value) {
+ if (parent.data.max && parentValue.length >= parent.data.max) {
+ return;
+ }
+ /* istanbul ignore else */
+ if (parentValue.indexOf(name) === -1) {
+ parentValue.push(name);
+ parent.$emit('input', parentValue);
+ parent.$emit('change', parentValue);
+ }
+ }
+ else {
+ var index = parentValue.indexOf(name);
+ /* istanbul ignore else */
+ if (index !== -1) {
+ parentValue.splice(index, 1);
+ parent.$emit('input', parentValue);
+ parent.$emit('change', parentValue);
+ }
+ }
+ }
+ }
+});
diff --git a/lib/checkbox/index.json b/lib/checkbox/index.json
new file mode 100644
index 00000000..0a336c08
--- /dev/null
+++ b/lib/checkbox/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index"
+ }
+}
diff --git a/lib/checkbox/index.wxml b/lib/checkbox/index.wxml
new file mode 100644
index 00000000..1659ba43
--- /dev/null
+++ b/lib/checkbox/index.wxml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/checkbox/index.wxss b/lib/checkbox/index.wxss
new file mode 100644
index 00000000..9ead73ea
--- /dev/null
+++ b/lib/checkbox/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-checkbox{overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox__icon-wrap,.van-checkbox__label{display:inline-block;line-height:20px;vertical-align:middle}.van-checkbox__icon{display:block;font-size:14px;width:20px;height:20px;color:transparent;text-align:center;box-sizing:border-box;border:1px solid #e5e5e5;transition:.2s}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;border-color:#1989fa;background-color:#1989fa}.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:10px}.van-checkbox__label--left{float:left;margin:0 10px 0 0}.van-checkbox__label--disabled{color:#c9c9c9}.van-checkbox__label:empty{margin:0}
\ No newline at end of file
diff --git a/lib/col/index.js b/lib/col/index.js
new file mode 100644
index 00000000..1f6beedb
--- /dev/null
+++ b/lib/col/index.js
@@ -0,0 +1,25 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ relation: {
+ name: 'row',
+ type: 'ancestor'
+ },
+ props: {
+ span: Number,
+ offset: Number
+ },
+ data: {
+ style: ''
+ },
+ methods: {
+ setGutter: function (gutter) {
+ var padding = gutter / 2 + "px";
+ var style = gutter ? "padding-left: " + padding + "; padding-right: " + padding + ";" : '';
+ if (style !== this.data.style) {
+ this.set({ style: style });
+ }
+ }
+ }
+});
diff --git a/lib/col/index.json b/lib/col/index.json
new file mode 100644
index 00000000..467ce294
--- /dev/null
+++ b/lib/col/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/lib/col/index.wxml b/lib/col/index.wxml
new file mode 100644
index 00000000..a759aac5
--- /dev/null
+++ b/lib/col/index.wxml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/lib/col/index.wxss b/lib/col/index.wxss
new file mode 100644
index 00000000..44c896a3
--- /dev/null
+++ b/lib/col/index.wxss
@@ -0,0 +1 @@
+@import '../common/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%}
\ No newline at end of file
diff --git a/lib/collapse-item/index.js b/lib/collapse-item/index.js
new file mode 100644
index 00000000..3d200cca
--- /dev/null
+++ b/lib/collapse-item/index.js
@@ -0,0 +1,94 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ classes: ['title-class', 'content-class'],
+ relation: {
+ name: 'collapse',
+ type: 'ancestor',
+ linked: function (parent) {
+ this.parent = parent;
+ }
+ },
+ props: {
+ name: null,
+ title: null,
+ value: null,
+ icon: String,
+ label: String,
+ disabled: Boolean,
+ border: {
+ type: Boolean,
+ value: true
+ },
+ isLink: {
+ type: Boolean,
+ value: true
+ }
+ },
+ data: {
+ contentHeight: 0,
+ expanded: false
+ },
+ beforeCreate: function () {
+ this.animation = wx.createAnimation({
+ duration: 300,
+ timingFunction: 'ease-in-out'
+ });
+ },
+ methods: {
+ updateExpanded: function () {
+ if (!this.parent) {
+ return null;
+ }
+ var _a = this.parent.data, value = _a.value, accordion = _a.accordion, items = _a.items;
+ var name = this.data.name;
+ var index = items.indexOf(this);
+ var currentName = name == null ? index : name;
+ var expanded = accordion
+ ? value === currentName
+ : value.some(function (name) { return name === currentName; });
+ if (expanded !== this.data.expanded) {
+ this.updateStyle(expanded);
+ }
+ this.set({ index: index, expanded: expanded });
+ },
+ updateStyle: function (expanded) {
+ var _this = this;
+ this.getRect('.van-collapse-item__content').then(function (res) {
+ var animationData = _this.animation
+ .height(expanded ? res.height : 0)
+ .step()
+ .export();
+ if (expanded) {
+ _this.set({ animationData: animationData });
+ }
+ else {
+ _this.set({
+ contentHeight: res.height + 'px'
+ }, function () {
+ setTimeout(function () {
+ _this.set({ animationData: animationData });
+ }, 20);
+ });
+ }
+ });
+ },
+ onClick: function () {
+ if (this.data.disabled) {
+ return;
+ }
+ var _a = this.data, name = _a.name, expanded = _a.expanded;
+ var index = this.parent.data.items.indexOf(this);
+ var currentName = name == null ? index : name;
+ this.parent.switch(currentName, !expanded);
+ },
+ onTransitionEnd: function () {
+ if (this.data.expanded) {
+ this.set({
+ contentHeight: 'auto'
+ });
+ }
+ }
+ }
+});
diff --git a/lib/collapse-item/index.json b/lib/collapse-item/index.json
new file mode 100644
index 00000000..0e5425cd
--- /dev/null
+++ b/lib/collapse-item/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-cell": "../cell/index"
+ }
+}
diff --git a/lib/collapse-item/index.wxml b/lib/collapse-item/index.wxml
new file mode 100644
index 00000000..b39e4cea
--- /dev/null
+++ b/lib/collapse-item/index.wxml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/collapse-item/index.wxss b/lib/collapse-item/index.wxss
new file mode 100644
index 00000000..34f032ad
--- /dev/null
+++ b/lib/collapse-item/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-collapse-item__title .van-cell__right-icon{-webkit-transform:rotate(90deg);transform:rotate(90deg);transition:.3s}.van-collapse-item__title--expanded .van-cell__right-icon{-webkit-transform:rotate(-90deg);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__content{padding:15px;font-size:13px;line-height:1.5;color:#999;background-color:#fff}
\ No newline at end of file
diff --git a/lib/collapse/index.js b/lib/collapse/index.js
new file mode 100644
index 00000000..6ddc0090
--- /dev/null
+++ b/lib/collapse/index.js
@@ -0,0 +1,54 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ relation: {
+ name: 'collapse-item',
+ type: 'descendant',
+ linked: function (child) {
+ this.set({
+ items: this.data.items.concat([child])
+ }, function () {
+ child.updateExpanded();
+ });
+ }
+ },
+ props: {
+ value: null,
+ accordion: Boolean,
+ border: {
+ type: Boolean,
+ value: true
+ }
+ },
+ data: {
+ items: []
+ },
+ watch: {
+ value: function () {
+ this.data.items.forEach(function (child) {
+ child.updateExpanded();
+ });
+ },
+ accordion: function () {
+ this.data.items.forEach(function (child) {
+ child.updateExpanded();
+ });
+ }
+ },
+ methods: {
+ switch: function (name, expanded) {
+ var _a = this.data, accordion = _a.accordion, value = _a.value;
+ if (!accordion) {
+ name = expanded
+ ? value.concat(name)
+ : value.filter(function (activeName) { return activeName !== name; });
+ }
+ else {
+ name = expanded ? name : '';
+ }
+ this.$emit('change', name);
+ this.$emit('input', name);
+ }
+ }
+});
diff --git a/lib/collapse/index.json b/lib/collapse/index.json
new file mode 100644
index 00000000..467ce294
--- /dev/null
+++ b/lib/collapse/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/lib/collapse/index.wxml b/lib/collapse/index.wxml
new file mode 100644
index 00000000..fd4e1719
--- /dev/null
+++ b/lib/collapse/index.wxml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/lib/collapse/index.wxss b/lib/collapse/index.wxss
new file mode 100644
index 00000000..99694d60
--- /dev/null
+++ b/lib/collapse/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';
\ No newline at end of file
diff --git a/lib/common/color.js b/lib/common/color.js
new file mode 100644
index 00000000..be4c57b5
--- /dev/null
+++ b/lib/common/color.js
@@ -0,0 +1,5 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.RED = '#f44';
+exports.BLUE = '#1989fa';
+exports.GREEN = '#07c160';
diff --git a/lib/common/component.js b/lib/common/component.js
new file mode 100644
index 00000000..1444a8c2
--- /dev/null
+++ b/lib/common/component.js
@@ -0,0 +1,52 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var basic_1 = require("../mixins/basic");
+var index_1 = require("../mixins/observer/index");
+function mapKeys(source, target, map) {
+ Object.keys(map).forEach(function (key) {
+ if (source[key]) {
+ target[map[key]] = source[key];
+ }
+ });
+}
+function VantComponent(vantOptions) {
+ if (vantOptions === void 0) { vantOptions = {}; }
+ var _a;
+ var options = {};
+ mapKeys(vantOptions, options, {
+ data: 'data',
+ props: 'properties',
+ mixins: 'behaviors',
+ methods: 'methods',
+ beforeCreate: 'created',
+ created: 'attached',
+ mounted: 'ready',
+ relations: 'relations',
+ destroyed: 'detached',
+ classes: 'externalClasses'
+ });
+ var relation = vantOptions.relation;
+ if (relation) {
+ options.relations = Object.assign(options.relations || {}, (_a = {},
+ _a["../" + relation.name + "/index"] = relation,
+ _a));
+ }
+ // add default externalClasses
+ options.externalClasses = options.externalClasses || [];
+ options.externalClasses.push('custom-class');
+ // add default behaviors
+ options.behaviors = options.behaviors || [];
+ options.behaviors.push(basic_1.basic);
+ // map field to form-field behavior
+ if (vantOptions.field) {
+ options.behaviors.push('wx://form-field');
+ }
+ // add default options
+ options.options = {
+ multipleSlots: true,
+ addGlobalClass: true
+ };
+ index_1.observe(vantOptions, options);
+ Component(options);
+}
+exports.VantComponent = VantComponent;
diff --git a/lib/common/index.wxss b/lib/common/index.wxss
new file mode 100644
index 00000000..1b5b4ee2
--- /dev/null
+++ b/lib/common/index.wxss
@@ -0,0 +1 @@
+.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;-webkit-transform-origin:center;transform-origin:center;top:-50%;left:-50%;right:-50%;bottom:-50%;-webkit-transform:scale(.5);transform:scale(.5);border:0 solid #eee}.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}
\ No newline at end of file
diff --git a/lib/common/style/clearfix.wxss b/lib/common/style/clearfix.wxss
new file mode 100644
index 00000000..8d6328c2
--- /dev/null
+++ b/lib/common/style/clearfix.wxss
@@ -0,0 +1 @@
+.van-clearfix:after{content:"";display:table;clear:both}
\ No newline at end of file
diff --git a/lib/common/style/ellipsis.wxss b/lib/common/style/ellipsis.wxss
new file mode 100644
index 00000000..a829a98f
--- /dev/null
+++ b/lib/common/style/ellipsis.wxss
@@ -0,0 +1 @@
+.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}
\ No newline at end of file
diff --git a/lib/common/style/hairline.wxss b/lib/common/style/hairline.wxss
new file mode 100644
index 00000000..53508ad9
--- /dev/null
+++ b/lib/common/style/hairline.wxss
@@ -0,0 +1 @@
+.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;-webkit-transform-origin:center;transform-origin:center;top:-50%;left:-50%;right:-50%;bottom:-50%;-webkit-transform:scale(.5);transform:scale(.5);border:0 solid #eee}.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}
\ No newline at end of file
diff --git a/lib/common/style/mixins/clearfix.wxss b/lib/common/style/mixins/clearfix.wxss
new file mode 100644
index 00000000..e69de29b
diff --git a/lib/common/style/mixins/ellipsis.wxss b/lib/common/style/mixins/ellipsis.wxss
new file mode 100644
index 00000000..e69de29b
diff --git a/lib/common/style/mixins/hairline.wxss b/lib/common/style/mixins/hairline.wxss
new file mode 100644
index 00000000..e69de29b
diff --git a/lib/common/style/var.wxss b/lib/common/style/var.wxss
new file mode 100644
index 00000000..e69de29b
diff --git a/lib/common/utils.js b/lib/common/utils.js
new file mode 100644
index 00000000..503a9826
--- /dev/null
+++ b/lib/common/utils.js
@@ -0,0 +1,19 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+function isDef(value) {
+ return value !== undefined && value !== null;
+}
+exports.isDef = isDef;
+function isObj(x) {
+ var type = typeof x;
+ return x !== null && (type === 'object' || type === 'function');
+}
+exports.isObj = isObj;
+function isNumber(value) {
+ return /^\d+$/.test(value);
+}
+exports.isNumber = isNumber;
+function range(num, min, max) {
+ return Math.min(Math.max(num, min), max);
+}
+exports.range = range;
diff --git a/lib/datetime-picker/index.js b/lib/datetime-picker/index.js
new file mode 100644
index 00000000..8fd2858e
--- /dev/null
+++ b/lib/datetime-picker/index.js
@@ -0,0 +1,309 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var utils_1 = require("../common/utils");
+var currentYear = new Date().getFullYear();
+function isValidDate(date) {
+ return utils_1.isDef(date) && !isNaN(new Date(date).getTime());
+}
+function range(num, min, max) {
+ return Math.min(Math.max(num, min), max);
+}
+function padZero(val) {
+ return ("00" + val).slice(-2);
+}
+function times(n, iteratee) {
+ var index = -1;
+ var result = Array(n);
+ while (++index < n) {
+ result[index] = iteratee(index);
+ }
+ return result;
+}
+function getTrueValue(formattedValue) {
+ if (!formattedValue)
+ return;
+ while (isNaN(parseInt(formattedValue, 10))) {
+ formattedValue = formattedValue.slice(1);
+ }
+ return parseInt(formattedValue, 10);
+}
+function getMonthEndDay(year, month) {
+ return 32 - new Date(year, month - 1, 32).getDate();
+}
+component_1.VantComponent({
+ props: {
+ value: null,
+ title: String,
+ loading: Boolean,
+ itemHeight: {
+ type: Number,
+ value: 44
+ },
+ visibleItemCount: {
+ type: Number,
+ value: 5
+ },
+ confirmButtonText: {
+ type: String,
+ value: '确认'
+ },
+ cancelButtonText: {
+ type: String,
+ value: '取消'
+ },
+ type: {
+ type: String,
+ value: 'datetime'
+ },
+ showToolbar: {
+ type: Boolean,
+ value: true
+ },
+ minDate: {
+ type: Number,
+ value: new Date(currentYear - 10, 0, 1).getTime()
+ },
+ maxDate: {
+ type: Number,
+ value: new Date(currentYear + 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 (val) {
+ var _this = this;
+ var data = this.data;
+ val = this.correctValue(val);
+ var isEqual = val === data.innerValue;
+ if (!isEqual) {
+ this.updateColumnValue(val).then(function () {
+ _this.$emit('input', val);
+ });
+ }
+ },
+ type: 'updateColumns',
+ minHour: 'updateColumns',
+ maxHour: 'updateColumns',
+ minMinute: 'updateColumns',
+ maxMinute: 'updateColumns'
+ },
+ methods: {
+ getPicker: function () {
+ if (this.picker == null) {
+ var picker_1 = this.picker = this.selectComponent('.van-datetime-picker');
+ var setColumnValues_1 = picker_1.setColumnValues;
+ picker_1.setColumnValues = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return setColumnValues_1.apply(picker_1, args.concat([false]));
+ };
+ }
+ return this.picker;
+ },
+ updateColumns: function () {
+ var results = this.getRanges().map(function (_a, index) {
+ var type = _a.type, range = _a.range;
+ var values = times(range[1] - range[0] + 1, function (index) {
+ var value = range[0] + index;
+ value = type === 'year' ? "" + value : padZero(value);
+ return value;
+ });
+ return { values: values };
+ });
+ return this.set({ columns: results });
+ },
+ getRanges: function () {
+ var data = this.data;
+ if (data.type === 'time') {
+ return [
+ {
+ type: 'hour',
+ range: [data.minHour, data.maxHour]
+ },
+ {
+ type: 'minute',
+ range: [data.minMinute, data.maxMinute]
+ }
+ ];
+ }
+ var _a = this.getBoundary('max', data.innerValue), maxYear = _a.maxYear, maxDate = _a.maxDate, maxMonth = _a.maxMonth, maxHour = _a.maxHour, maxMinute = _a.maxMinute;
+ var _b = this.getBoundary('min', data.innerValue), minYear = _b.minYear, minDate = _b.minDate, minMonth = _b.minMonth, minHour = _b.minHour, minMinute = _b.minMinute;
+ var result = [
+ {
+ type: 'year',
+ range: [minYear, maxYear]
+ },
+ {
+ type: 'month',
+ range: [minMonth, maxMonth]
+ },
+ {
+ type: 'day',
+ range: [minDate, maxDate]
+ },
+ {
+ type: 'hour',
+ range: [minHour, maxHour]
+ },
+ {
+ type: 'minute',
+ range: [minMinute, maxMinute]
+ }
+ ];
+ if (data.type === 'date')
+ result.splice(3, 2);
+ if (data.type === 'year-month')
+ result.splice(2, 3);
+ return result;
+ },
+ correctValue: function (value) {
+ var data = this.data;
+ // validate value
+ var isDateType = data.type !== 'time';
+ if (isDateType && !isValidDate(value)) {
+ value = data.minDate;
+ }
+ else if (!isDateType && !value) {
+ var minHour = data.minHour;
+ value = padZero(minHour) + ":00";
+ }
+ // time type
+ if (!isDateType) {
+ var _a = value.split(':'), hour = _a[0], minute = _a[1];
+ hour = padZero(range(hour, data.minHour, data.maxHour));
+ minute = padZero(range(minute, data.minMinute, data.maxMinute));
+ return hour + ":" + minute;
+ }
+ // date type
+ value = Math.max(value, data.minDate);
+ value = Math.min(value, data.maxDate);
+ return value;
+ },
+ getBoundary: function (type, innerValue) {
+ var _a;
+ var value = new Date(innerValue);
+ var boundary = new Date(this.data[type + "Date"]);
+ var year = boundary.getFullYear();
+ var month = 1;
+ var date = 1;
+ var hour = 0;
+ var minute = 0;
+ if (type === 'max') {
+ month = 12;
+ date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
+ hour = 23;
+ minute = 59;
+ }
+ if (value.getFullYear() === year) {
+ month = boundary.getMonth() + 1;
+ if (value.getMonth() + 1 === month) {
+ date = boundary.getDate();
+ if (value.getDate() === date) {
+ hour = boundary.getHours();
+ if (value.getHours() === hour) {
+ minute = boundary.getMinutes();
+ }
+ }
+ }
+ }
+ return _a = {},
+ _a[type + "Year"] = year,
+ _a[type + "Month"] = month,
+ _a[type + "Date"] = date,
+ _a[type + "Hour"] = hour,
+ _a[type + "Minute"] = minute,
+ _a;
+ },
+ onCancel: function () {
+ this.$emit('cancel');
+ },
+ onConfirm: function () {
+ this.$emit('confirm', this.data.innerValue);
+ },
+ onChange: function () {
+ var _this = this;
+ var data = this.data;
+ var value;
+ var picker = this.getPicker();
+ if (data.type === 'time') {
+ var indexes = picker.getIndexes();
+ value = indexes[0] + data.minHour + ":" + (indexes[1] + data.minMinute);
+ }
+ else {
+ var values = picker.getValues();
+ var year = getTrueValue(values[0]);
+ var month = getTrueValue(values[1]);
+ var maxDate = getMonthEndDay(year, month);
+ var date = getTrueValue(values[2]);
+ if (data.type === 'year-month') {
+ date = 1;
+ }
+ date = date > maxDate ? maxDate : date;
+ var hour = 0;
+ var minute = 0;
+ if (data.type === 'datetime') {
+ hour = getTrueValue(values[3]);
+ minute = getTrueValue(values[4]);
+ }
+ value = new Date(year, month - 1, date, hour, minute);
+ }
+ value = this.correctValue(value);
+ this.updateColumnValue(value).then(function () {
+ _this.$emit('input', value);
+ _this.$emit('change', picker);
+ });
+ },
+ updateColumnValue: function (value) {
+ var _this = this;
+ var values = [];
+ var data = this.data;
+ var picker = this.getPicker();
+ if (data.type === 'time') {
+ var pair = value.split(':');
+ values = [pair[0], pair[1]];
+ }
+ else {
+ var date = new Date(value);
+ values = ["" + date.getFullYear(), padZero(date.getMonth() + 1)];
+ if (data.type === 'date') {
+ values.push(padZero(date.getDate()));
+ }
+ if (data.type === 'datetime') {
+ values.push(padZero(date.getDate()), padZero(date.getHours()), padZero(date.getMinutes()));
+ }
+ }
+ return this.set({ innerValue: value })
+ .then(function () { return _this.updateColumns(); })
+ .then(function () { return picker.setValues(values); });
+ }
+ },
+ created: function () {
+ var _this = this;
+ var innerValue = this.correctValue(this.data.value);
+ this.updateColumnValue(innerValue).then(function () {
+ _this.$emit('input', innerValue);
+ });
+ }
+});
diff --git a/lib/datetime-picker/index.json b/lib/datetime-picker/index.json
new file mode 100644
index 00000000..a778e91c
--- /dev/null
+++ b/lib/datetime-picker/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-picker": "../picker/index"
+ }
+}
diff --git a/lib/datetime-picker/index.wxml b/lib/datetime-picker/index.wxml
new file mode 100644
index 00000000..13a1b478
--- /dev/null
+++ b/lib/datetime-picker/index.wxml
@@ -0,0 +1,13 @@
+
diff --git a/lib/datetime-picker/index.wxss b/lib/datetime-picker/index.wxss
new file mode 100644
index 00000000..99694d60
--- /dev/null
+++ b/lib/datetime-picker/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';
\ No newline at end of file
diff --git a/lib/dialog/dialog.js b/lib/dialog/dialog.js
new file mode 100644
index 00000000..501ed0a1
--- /dev/null
+++ b/lib/dialog/dialog.js
@@ -0,0 +1,73 @@
+"use strict";
+var __assign = (this && this.__assign) || function () {
+ __assign = Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+var queue = [];
+function getContext() {
+ var pages = getCurrentPages();
+ return pages[pages.length - 1];
+}
+var Dialog = function (options) {
+ options = __assign({}, Dialog.currentOptions, options);
+ return new Promise(function (resolve, reject) {
+ var context = options.context || getContext();
+ var dialog = context.selectComponent(options.selector);
+ delete options.selector;
+ if (dialog) {
+ dialog.set(__assign({ onCancel: reject, onConfirm: resolve }, options));
+ queue.push(dialog);
+ }
+ else {
+ console.warn('未找到 van-dialog 节点,请确认 selector 及 context 是否正确');
+ }
+ });
+};
+Dialog.defaultOptions = {
+ show: true,
+ title: '',
+ message: '',
+ zIndex: 100,
+ overlay: true,
+ asyncClose: false,
+ messageAlign: '',
+ transition: 'scale',
+ selector: '#van-dialog',
+ confirmButtonText: '确认',
+ cancelButtonText: '取消',
+ showConfirmButton: true,
+ showCancelButton: false,
+ closeOnClickOverlay: false,
+ confirmButtonOpenType: ''
+};
+Dialog.alert = Dialog;
+Dialog.confirm = function (options) {
+ return Dialog(__assign({ showCancelButton: true }, options));
+};
+Dialog.close = function () {
+ queue.forEach(function (dialog) {
+ dialog.close();
+ });
+ queue = [];
+};
+Dialog.stopLoading = function () {
+ queue.forEach(function (dialog) {
+ dialog.stopLoading();
+ });
+};
+Dialog.setDefaultOptions = function (options) {
+ Object.assign(Dialog.currentOptions, options);
+};
+Dialog.resetDefaultOptions = function () {
+ Dialog.currentOptions = __assign({}, Dialog.defaultOptions);
+};
+Dialog.resetDefaultOptions();
+exports.default = Dialog;
diff --git a/lib/dialog/index.js b/lib/dialog/index.js
new file mode 100644
index 00000000..e1926466
--- /dev/null
+++ b/lib/dialog/index.js
@@ -0,0 +1,99 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var button_1 = require("../mixins/button");
+var open_type_1 = require("../mixins/open-type");
+component_1.VantComponent({
+ mixins: [button_1.button, open_type_1.openType],
+ props: {
+ show: Boolean,
+ title: String,
+ message: String,
+ useSlot: Boolean,
+ asyncClose: Boolean,
+ messageAlign: String,
+ showCancelButton: Boolean,
+ closeOnClickOverlay: Boolean,
+ confirmButtonOpenType: String,
+ zIndex: {
+ type: Number,
+ value: 2000
+ },
+ confirmButtonText: {
+ type: String,
+ value: '确认'
+ },
+ cancelButtonText: {
+ type: String,
+ value: '取消'
+ },
+ showConfirmButton: {
+ type: Boolean,
+ value: true
+ },
+ overlay: {
+ type: Boolean,
+ value: true
+ },
+ transition: {
+ type: String,
+ value: 'scale'
+ }
+ },
+ data: {
+ loading: {
+ confirm: false,
+ cancel: false
+ }
+ },
+ watch: {
+ show: function (show) {
+ !show && this.stopLoading();
+ }
+ },
+ methods: {
+ onConfirm: function () {
+ this.handleAction('confirm');
+ },
+ onCancel: function () {
+ this.handleAction('cancel');
+ },
+ onClickOverlay: function () {
+ this.onClose('overlay');
+ },
+ handleAction: function (action) {
+ var _a;
+ if (this.data.asyncClose) {
+ this.set((_a = {},
+ _a["loading." + action] = true,
+ _a));
+ }
+ this.onClose(action);
+ },
+ close: function () {
+ this.set({
+ show: false
+ });
+ },
+ stopLoading: function () {
+ this.set({
+ loading: {
+ confirm: false,
+ cancel: false
+ }
+ });
+ },
+ onClose: function (action) {
+ if (!this.data.asyncClose) {
+ this.close();
+ }
+ this.$emit('close', action);
+ //把 dialog 实例传递出去,可以通过 stopLoading() 在外部关闭按钮的 loading
+ this.$emit(action, { dialog: this });
+ var callback = this.data[action === 'confirm' ? 'onConfirm' : 'onCancel'];
+ if (callback) {
+ callback(this);
+ }
+ }
+ }
+});
diff --git a/lib/dialog/index.json b/lib/dialog/index.json
new file mode 100644
index 00000000..e2ee09ae
--- /dev/null
+++ b/lib/dialog/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-popup": "../popup/index",
+ "van-button": "../button/index"
+ }
+}
diff --git a/lib/dialog/index.wxml b/lib/dialog/index.wxml
new file mode 100644
index 00000000..c1d38990
--- /dev/null
+++ b/lib/dialog/index.wxml
@@ -0,0 +1,64 @@
+
+
+
+
+
+ {{ message }}
+
+
+
+
diff --git a/lib/dialog/index.wxss b/lib/dialog/index.wxss
new file mode 100644
index 00000000..eea753a8
--- /dev/null
+++ b/lib/dialog/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-dialog{width:85%;overflow:hidden;font-size:16px;background-color:#fff;border-radius:4px}.van-dialog__header{padding-top:25px;font-weight:500;text-align:center}.van-dialog__header--isolated{padding:25px 0}.van-dialog__message{max-height:60vh;padding:25px;overflow-y:auto;font-size:14px;line-height:1.5;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:-webkit-flex;display:flex}.van-dialog__button{-webkit-flex:1;flex:1}.van-dialog__cancel,.van-dialog__confirm{border:0!important}.van-dialog__confirm{color:#1989fa!important}.van-dialog-bounce-enter{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7)}.van-dialog-bounce-leave-active{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9)}
\ No newline at end of file
diff --git a/lib/field/index.js b/lib/field/index.js
new file mode 100644
index 00000000..1c439e40
--- /dev/null
+++ b/lib/field/index.js
@@ -0,0 +1,135 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ field: true,
+ classes: ['input-class'],
+ props: {
+ size: String,
+ icon: String,
+ label: String,
+ error: Boolean,
+ fixed: Boolean,
+ focus: Boolean,
+ center: Boolean,
+ isLink: Boolean,
+ leftIcon: String,
+ disabled: Boolean,
+ autosize: Boolean,
+ readonly: Boolean,
+ required: Boolean,
+ iconClass: String,
+ clearable: Boolean,
+ inputAlign: String,
+ customClass: String,
+ confirmType: String,
+ confirmHold: Boolean,
+ errorMessage: String,
+ placeholder: String,
+ customStyle: String,
+ useIconSlot: Boolean,
+ useButtonSlot: Boolean,
+ showConfirmBar: {
+ type: Boolean,
+ value: true
+ },
+ placeholderStyle: String,
+ adjustPosition: {
+ type: Boolean,
+ value: true
+ },
+ cursorSpacing: {
+ type: Number,
+ value: 50
+ },
+ maxlength: {
+ type: Number,
+ value: -1
+ },
+ type: {
+ type: String,
+ value: 'text'
+ },
+ border: {
+ type: Boolean,
+ value: true
+ },
+ titleWidth: {
+ type: String,
+ value: '90px'
+ }
+ },
+ data: {
+ showClear: false
+ },
+ beforeCreate: function () {
+ this.focused = false;
+ },
+ methods: {
+ onInput: function (event) {
+ var _this = this;
+ var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a;
+ this.set({
+ value: value,
+ showClear: this.getShowClear(value)
+ }, function () {
+ _this.emitChange(value);
+ });
+ },
+ onFocus: function (event) {
+ var _a = event.detail || {}, _b = _a.value, value = _b === void 0 ? '' : _b, _c = _a.height, height = _c === void 0 ? 0 : _c;
+ this.$emit('focus', { value: value, height: height });
+ this.focused = true;
+ this.blurFromClear = false;
+ this.set({
+ showClear: this.getShowClear()
+ });
+ },
+ onBlur: function (event) {
+ var _this = this;
+ var _a = event.detail || {}, _b = _a.value, value = _b === void 0 ? '' : _b, _c = _a.cursor, cursor = _c === void 0 ? 0 : _c;
+ this.$emit('blur', { value: value, cursor: cursor });
+ this.focused = false;
+ var showClear = this.getShowClear();
+ if (this.data.value === value) {
+ this.set({
+ showClear: showClear
+ });
+ }
+ else if (!this.blurFromClear) {
+ // fix: the handwritten keyboard does not trigger input change
+ this.set({
+ value: value,
+ showClear: showClear
+ }, function () {
+ _this.emitChange(value);
+ });
+ }
+ },
+ onClickIcon: function () {
+ this.$emit('click-icon');
+ },
+ getShowClear: function (value) {
+ value = value === undefined ? this.data.value : value;
+ return (this.data.clearable && this.focused && value && !this.data.readonly);
+ },
+ onClear: function () {
+ var _this = this;
+ this.blurFromClear = true;
+ this.set({
+ value: '',
+ showClear: this.getShowClear('')
+ }, function () {
+ _this.emitChange('');
+ _this.$emit('clear', '');
+ });
+ },
+ onConfirm: function () {
+ this.$emit('confirm', this.data.value);
+ },
+ emitChange: function (value) {
+ this.$emit('input', value);
+ this.$emit('change', value);
+ }
+ }
+});
diff --git a/lib/field/index.json b/lib/field/index.json
new file mode 100644
index 00000000..8809c46b
--- /dev/null
+++ b/lib/field/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-cell": "../cell/index",
+ "van-icon": "../icon/index"
+ }
+}
\ No newline at end of file
diff --git a/lib/field/index.wxml b/lib/field/index.wxml
new file mode 100644
index 00000000..baa5f4df
--- /dev/null
+++ b/lib/field/index.wxml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ errorMessage }}
+
+
diff --git a/lib/field/index.wxss b/lib/field/index.wxss
new file mode 100644
index 00000000..4853be90
--- /dev/null
+++ b/lib/field/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-field__body{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.van-field__body--textarea{min-height:24px}.van-field__input{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__input--error{color:#f44}.van-field__placeholder{color:#999}.van-field__clear-root{display:-webkit-flex;display:flex;height:24px;-webkit-align-items:center;align-items:center}.van-field__button,.van-field__clear,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear,.van-field__icon-container{padding:0 10px;margin-right:-10px;line-height:inherit;vertical-align:middle}.van-field__clear{color:#c9c9c9}.van-field__icon-container{color:#999}.van-field__icon{display:block!important}.van-field__button{padding-left:10px}.van-field__error-message{font-size:12px;color:#f44;text-align:left}
\ No newline at end of file
diff --git a/lib/goods-action-button/index.js b/lib/goods-action-button/index.js
new file mode 100644
index 00000000..943728c2
--- /dev/null
+++ b/lib/goods-action-button/index.js
@@ -0,0 +1,24 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var link_1 = require("../mixins/link");
+var button_1 = require("../mixins/button");
+var open_type_1 = require("../mixins/open-type");
+component_1.VantComponent({
+ mixins: [link_1.link, button_1.button, open_type_1.openType],
+ props: {
+ text: String,
+ loading: Boolean,
+ disabled: Boolean,
+ type: {
+ type: String,
+ value: 'danger'
+ }
+ },
+ methods: {
+ onClick: function (event) {
+ this.$emit('click', event.detail);
+ this.jumpLink();
+ }
+ }
+});
diff --git a/lib/goods-action-button/index.json b/lib/goods-action-button/index.json
new file mode 100644
index 00000000..b5676868
--- /dev/null
+++ b/lib/goods-action-button/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-button": "../button/index"
+ }
+}
diff --git a/lib/goods-action-button/index.wxml b/lib/goods-action-button/index.wxml
new file mode 100644
index 00000000..39296d59
--- /dev/null
+++ b/lib/goods-action-button/index.wxml
@@ -0,0 +1,27 @@
+
+ {{ text }}
+
diff --git a/lib/goods-action-button/index.wxss b/lib/goods-action-button/index.wxss
new file mode 100644
index 00000000..58001977
--- /dev/null
+++ b/lib/goods-action-button/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}
\ No newline at end of file
diff --git a/lib/goods-action-icon/index.js b/lib/goods-action-icon/index.js
new file mode 100644
index 00000000..b43fc359
--- /dev/null
+++ b/lib/goods-action-icon/index.js
@@ -0,0 +1,23 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var link_1 = require("../mixins/link");
+var button_1 = require("../mixins/button");
+var open_type_1 = require("../mixins/open-type");
+component_1.VantComponent({
+ classes: ['icon-class', 'text-class'],
+ mixins: [link_1.link, button_1.button, open_type_1.openType],
+ props: {
+ text: String,
+ info: String,
+ icon: String,
+ disabled: Boolean,
+ loading: Boolean
+ },
+ methods: {
+ onClick: function (event) {
+ this.$emit('click', event.detail);
+ this.jumpLink();
+ }
+ }
+});
diff --git a/lib/goods-action-icon/index.json b/lib/goods-action-icon/index.json
new file mode 100644
index 00000000..93bfe8ab
--- /dev/null
+++ b/lib/goods-action-icon/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index",
+ "van-button": "../button/index"
+ }
+}
diff --git a/lib/goods-action-icon/index.wxml b/lib/goods-action-icon/index.wxml
new file mode 100644
index 00000000..40c0773d
--- /dev/null
+++ b/lib/goods-action-icon/index.wxml
@@ -0,0 +1,35 @@
+
+
+
+ {{ text }}
+
+
diff --git a/lib/goods-action-icon/index.wxss b/lib/goods-action-icon/index.wxss
new file mode 100644
index 00000000..674d0a04
--- /dev/null
+++ b/lib/goods-action-icon/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-goods-action-icon{width:50px!important;border:none!important}.van-goods-action-icon__content{display:-webkit-flex;display:flex;height:100%;font-size:10px;line-height:1;color:#7d7e80;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center}.van-goods-action-icon__icon{margin-bottom:4px}
\ No newline at end of file
diff --git a/lib/goods-action/index.js b/lib/goods-action/index.js
new file mode 100644
index 00000000..7305e505
--- /dev/null
+++ b/lib/goods-action/index.js
@@ -0,0 +1,7 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var safe_area_1 = require("../mixins/safe-area");
+component_1.VantComponent({
+ mixins: [safe_area_1.safeArea()]
+});
diff --git a/lib/goods-action/index.json b/lib/goods-action/index.json
new file mode 100644
index 00000000..467ce294
--- /dev/null
+++ b/lib/goods-action/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/lib/goods-action/index.wxml b/lib/goods-action/index.wxml
new file mode 100644
index 00000000..6e61cc9e
--- /dev/null
+++ b/lib/goods-action/index.wxml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/lib/goods-action/index.wxss b/lib/goods-action/index.wxss
new file mode 100644
index 00000000..ce8200ce
--- /dev/null
+++ b/lib/goods-action/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;background-color:#fff}.van-goods-action--safe{padding-bottom:34px}
\ No newline at end of file
diff --git a/lib/icon/index.js b/lib/icon/index.js
new file mode 100644
index 00000000..ee032c74
--- /dev/null
+++ b/lib/icon/index.js
@@ -0,0 +1,21 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ props: {
+ info: null,
+ name: String,
+ size: String,
+ color: String,
+ customStyle: String,
+ classPrefix: {
+ type: String,
+ value: 'van-icon'
+ }
+ },
+ methods: {
+ onClick: function () {
+ this.$emit('click');
+ }
+ }
+});
diff --git a/lib/icon/index.json b/lib/icon/index.json
new file mode 100644
index 00000000..bf0ebe00
--- /dev/null
+++ b/lib/icon/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-info": "../info/index"
+ }
+}
diff --git a/lib/icon/index.wxml b/lib/icon/index.wxml
new file mode 100644
index 00000000..bfbb57cd
--- /dev/null
+++ b/lib/icon/index.wxml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/lib/icon/index.wxss b/lib/icon/index.wxss
new file mode 100644
index 00000000..5a4ec661
--- /dev/null
+++ b/lib/icon/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';@font-face{font-style:normal;font-weight:400;font-family:vant-icon;src:url(https://img.yzcdn.cn/vant/vant-icon-29f643.woff2) format("woff2"),url(https://img.yzcdn.cn/vant/vant-icon-29f643.woff) format("woff"),url(https://img.yzcdn.cn/vant/vant-icon-29f643.ttf) format("truetype")}.van-icon{position:relative;font:normal normal normal 14px/1 vant-icon;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased}.van-icon,.van-icon:before{display:inline-block}.van-icon-add-o:before{content:"\F000"}.van-icon-add-square:before{content:"\F001"}.van-icon-add:before{content:"\F002"}.van-icon-after-sale:before{content:"\F003"}.van-icon-aim:before{content:"\F004"}.van-icon-alipay:before{content:"\F005"}.van-icon-apps-o:before{content:"\F006"}.van-icon-arrow-down:before{content:"\F007"}.van-icon-arrow-left:before{content:"\F008"}.van-icon-arrow-up:before{content:"\F009"}.van-icon-arrow:before{content:"\F00A"}.van-icon-ascending:before{content:"\F00B"}.van-icon-audio:before{content:"\F00C"}.van-icon-award-o:before{content:"\F00D"}.van-icon-award:before{content:"\F00E"}.van-icon-bag-o:before{content:"\F00F"}.van-icon-bag:before{content:"\F010"}.van-icon-balance-list-o:before{content:"\F011"}.van-icon-balance-list:before{content:"\F012"}.van-icon-balance-o:before{content:"\F013"}.van-icon-balance-pay:before{content:"\F014"}.van-icon-bar-chart-o:before{content:"\F015"}.van-icon-bars:before{content:"\F016"}.van-icon-bell:before{content:"\F017"}.van-icon-bill-o:before{content:"\F018"}.van-icon-bill:before{content:"\F019"}.van-icon-birthday-cake-o:before{content:"\F01A"}.van-icon-bookmark-o:before{content:"\F01B"}.van-icon-bookmark:before{content:"\F01C"}.van-icon-browsing-history-o:before{content:"\F01D"}.van-icon-browsing-history:before{content:"\F01E"}.van-icon-brush-o:before{content:"\F01F"}.van-icon-bulb-o:before{content:"\F020"}.van-icon-bullhorn-o:before{content:"\F021"}.van-icon-calender-o:before{content:"\F022"}.van-icon-card:before{content:"\F023"}.van-icon-cart-circle-o:before{content:"\F024"}.van-icon-cart-circle:before{content:"\F025"}.van-icon-cart-o:before{content:"\F026"}.van-icon-cart:before{content:"\F027"}.van-icon-cash-back-record:before{content:"\F028"}.van-icon-cash-on-deliver:before{content:"\F029"}.van-icon-cashier-o:before{content:"\F02A"}.van-icon-certificate:before{content:"\F02B"}.van-icon-chart-trending-o:before{content:"\F02C"}.van-icon-chat-o:before{content:"\F02D"}.van-icon-chat:before{content:"\F02E"}.van-icon-checked:before{content:"\F02F"}.van-icon-circle:before{content:"\F030"}.van-icon-clear:before{content:"\F031"}.van-icon-clock-o:before{content:"\F032"}.van-icon-clock:before{content:"\F033"}.van-icon-close:before{content:"\F034"}.van-icon-closed-eye:before{content:"\F035"}.van-icon-cluster-o:before{content:"\F036"}.van-icon-cluster:before{content:"\F037"}.van-icon-column:before{content:"\F038"}.van-icon-comment-circle-o:before{content:"\F039"}.van-icon-comment-o:before{content:"\F03A"}.van-icon-comment:before{content:"\F03B"}.van-icon-completed:before{content:"\F03C"}.van-icon-contact:before{content:"\F03D"}.van-icon-coupon-o:before{content:"\F03E"}.van-icon-coupon:before{content:"\F03F"}.van-icon-credit-pay:before{content:"\F040"}.van-icon-cross:before{content:"\F041"}.van-icon-debit-pay:before{content:"\F042"}.van-icon-delete:before{content:"\F043"}.van-icon-descending:before{content:"\F044"}.van-icon-description:before{content:"\F045"}.van-icon-desktop-o:before{content:"\F046"}.van-icon-diamond-o:before{content:"\F047"}.van-icon-diamond:before{content:"\F048"}.van-icon-discount:before{content:"\F049"}.van-icon-ecard-pay:before{content:"\F04A"}.van-icon-edit:before{content:"\F04B"}.van-icon-ellipsis:before{content:"\F04C"}.van-icon-empty:before{content:"\F04D"}.van-icon-envelop-o:before{content:"\F04E"}.van-icon-exchange:before{content:"\F04F"}.van-icon-expand-o:before{content:"\F050"}.van-icon-expand:before{content:"\F051"}.van-icon-eye-o:before{content:"\F052"}.van-icon-eye:before{content:"\F053"}.van-icon-fail:before{content:"\F054"}.van-icon-failure:before{content:"\F055"}.van-icon-filter-o:before{content:"\F056"}.van-icon-fire-o:before{content:"\F057"}.van-icon-fire:before{content:"\F058"}.van-icon-flag-o:before{content:"\F059"}.van-icon-flower-o:before{content:"\F05A"}.van-icon-free-postage:before{content:"\F05B"}.van-icon-friends-o:before{content:"\F05C"}.van-icon-friends:before{content:"\F05D"}.van-icon-gem-o:before{content:"\F05E"}.van-icon-gem:before{content:"\F05F"}.van-icon-gift-card-o:before{content:"\F060"}.van-icon-gift-card:before{content:"\F061"}.van-icon-gift-o:before{content:"\F062"}.van-icon-gift:before{content:"\F063"}.van-icon-gold-coin-o:before{content:"\F064"}.van-icon-gold-coin:before{content:"\F065"}.van-icon-goods-collect-o:before{content:"\F066"}.van-icon-goods-collect:before{content:"\F067"}.van-icon-graphic:before{content:"\F068"}.van-icon-home-o:before{content:"\F069"}.van-icon-hot-o:before{content:"\F06A"}.van-icon-hot-sale-o:before{content:"\F06B"}.van-icon-hot-sale:before{content:"\F06C"}.van-icon-hot:before{content:"\F06D"}.van-icon-hotel-o:before{content:"\F06E"}.van-icon-idcard:before{content:"\F06F"}.van-icon-info-o:before{content:"\F070"}.van-icon-info:before{content:"\F071"}.van-icon-invition:before{content:"\F072"}.van-icon-label-o:before{content:"\F073"}.van-icon-label:before{content:"\F074"}.van-icon-like-o:before{content:"\F075"}.van-icon-like:before{content:"\F076"}.van-icon-live:before{content:"\F077"}.van-icon-location-o:before{content:"\F078"}.van-icon-location:before{content:"\F079"}.van-icon-lock:before{content:"\F07A"}.van-icon-logistics:before{content:"\F07B"}.van-icon-manager-o:before{content:"\F07C"}.van-icon-manager:before{content:"\F07D"}.van-icon-map-marked:before{content:"\F07E"}.van-icon-medel-o:before{content:"\F07F"}.van-icon-medel:before{content:"\F080"}.van-icon-more-o:before{content:"\F081"}.van-icon-more:before{content:"\F082"}.van-icon-music-o:before{content:"\F083"}.van-icon-new-arrival-o:before{content:"\F084"}.van-icon-new-arrival:before{content:"\F085"}.van-icon-new-o:before{content:"\F086"}.van-icon-new:before{content:"\F087"}.van-icon-newspaper-o:before{content:"\F088"}.van-icon-notes-o:before{content:"\F089"}.van-icon-orders-o:before{content:"\F08A"}.van-icon-other-pay:before{content:"\F08B"}.van-icon-paid:before{content:"\F08C"}.van-icon-passed:before{content:"\F08D"}.van-icon-pause-circle-o:before{content:"\F08E"}.van-icon-pause-circle:before{content:"\F08F"}.van-icon-pause:before{content:"\F090"}.van-icon-peer-pay:before{content:"\F091"}.van-icon-pending-payment:before{content:"\F092"}.van-icon-phone-circle-o:before{content:"\F093"}.van-icon-phone-o:before{content:"\F094"}.van-icon-phone:before{content:"\F095"}.van-icon-photo-o:before{content:"\F096"}.van-icon-photo:before{content:"\F097"}.van-icon-photograph:before{content:"\F098"}.van-icon-play-circle-o:before{content:"\F099"}.van-icon-play-circle:before{content:"\F09A"}.van-icon-play:before{content:"\F09B"}.van-icon-plus:before{content:"\F09C"}.van-icon-point-gift-o:before{content:"\F09D"}.van-icon-point-gift:before{content:"\F09E"}.van-icon-points:before{content:"\F09F"}.van-icon-printer:before{content:"\F0A0"}.van-icon-qr-invalid:before{content:"\F0A1"}.van-icon-qr:before{content:"\F0A2"}.van-icon-question-o:before{content:"\F0A3"}.van-icon-question:before{content:"\F0A4"}.van-icon-records:before{content:"\F0A5"}.van-icon-refund-o:before{content:"\F0A6"}.van-icon-replay:before{content:"\F0A7"}.van-icon-scan:before{content:"\F0A8"}.van-icon-search:before{content:"\F0A9"}.van-icon-send-gift-o:before{content:"\F0AA"}.van-icon-send-gift:before{content:"\F0AB"}.van-icon-service-o:before{content:"\F0AC"}.van-icon-service:before{content:"\F0AD"}.van-icon-setting-o:before{content:"\F0AE"}.van-icon-setting:before{content:"\F0AF"}.van-icon-share:before{content:"\F0B0"}.van-icon-shop-collect-o:before{content:"\F0B1"}.van-icon-shop-collect:before{content:"\F0B2"}.van-icon-shop-o:before{content:"\F0B3"}.van-icon-shop:before{content:"\F0B4"}.van-icon-shopping-cart-o:before{content:"\F0B5"}.van-icon-shopping-cart:before{content:"\F0B6"}.van-icon-shrink:before{content:"\F0B7"}.van-icon-sign:before{content:"\F0B8"}.van-icon-smile-comment-o:before{content:"\F0B9"}.van-icon-smile-comment:before{content:"\F0BA"}.van-icon-smile-o:before{content:"\F0BB"}.van-icon-star-o:before{content:"\F0BC"}.van-icon-star:before{content:"\F0BD"}.van-icon-stop-circle-o:before{content:"\F0BE"}.van-icon-stop-circle:before{content:"\F0BF"}.van-icon-stop:before{content:"\F0C0"}.van-icon-success:before{content:"\F0C1"}.van-icon-thumb-circle-o:before{content:"\F0C2"}.van-icon-todo-list-o:before{content:"\F0C3"}.van-icon-todo-list:before{content:"\F0C4"}.van-icon-tosend:before{content:"\F0C5"}.van-icon-tv-o:before{content:"\F0C6"}.van-icon-umbrella-circle:before{content:"\F0C7"}.van-icon-underway-o:before{content:"\F0C8"}.van-icon-underway:before{content:"\F0C9"}.van-icon-upgrade:before{content:"\F0CA"}.van-icon-user-circle-o:before{content:"\F0CB"}.van-icon-user-o:before{content:"\F0CC"}.van-icon-video-o:before{content:"\F0CD"}.van-icon-video:before{content:"\F0CE"}.van-icon-vip-card-o:before{content:"\F0CF"}.van-icon-vip-card:before{content:"\F0D0"}.van-icon-volume-o:before{content:"\F0D1"}.van-icon-volume:before{content:"\F0D2"}.van-icon-wap-home:before{content:"\F0D3"}.van-icon-wap-nav:before{content:"\F0D4"}.van-icon-warn-o:before{content:"\F0D5"}.van-icon-warning-o:before{content:"\F0D6"}.van-icon-weapp-nav:before{content:"\F0D7"}.van-icon-wechat:before{content:"\F0D8"}.van-icon-youzan-shield:before{content:"\F0D9"}.van-icon--image{width:1em;height:1em}.van-icon__image{position:absolute;top:0;right:0;bottom:0;left:0;max-width:100%;max-height:100%;margin:auto}.van-icon__info{z-index:1}
\ No newline at end of file
diff --git a/lib/info/index.js b/lib/info/index.js
new file mode 100644
index 00000000..a2de7767
--- /dev/null
+++ b/lib/info/index.js
@@ -0,0 +1,9 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ props: {
+ info: null,
+ customStyle: String
+ }
+});
diff --git a/lib/info/index.json b/lib/info/index.json
new file mode 100644
index 00000000..467ce294
--- /dev/null
+++ b/lib/info/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/lib/info/index.wxml b/lib/info/index.wxml
new file mode 100644
index 00000000..d5740fbb
--- /dev/null
+++ b/lib/info/index.wxml
@@ -0,0 +1,5 @@
+{{ info }}
diff --git a/lib/info/index.wxss b/lib/info/index.wxss
new file mode 100644
index 00000000..f9c10d0c
--- /dev/null
+++ b/lib/info/index.wxss
@@ -0,0 +1 @@
+@import '../common/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;-webkit-transform:translateX(50%);transform:translateX(50%);box-sizing:border-box;-webkit-transform-origin:100%;transform-origin:100%}
\ No newline at end of file
diff --git a/lib/loading/index.js b/lib/loading/index.js
new file mode 100644
index 00000000..57510052
--- /dev/null
+++ b/lib/loading/index.js
@@ -0,0 +1,19 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ props: {
+ size: {
+ type: String,
+ value: '30px'
+ },
+ type: {
+ type: String,
+ value: 'circular'
+ },
+ color: {
+ type: String,
+ value: '#c9c9c9'
+ }
+ }
+});
diff --git a/lib/loading/index.json b/lib/loading/index.json
new file mode 100644
index 00000000..32640e0d
--- /dev/null
+++ b/lib/loading/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
\ No newline at end of file
diff --git a/lib/loading/index.wxml b/lib/loading/index.wxml
new file mode 100644
index 00000000..35ca0e22
--- /dev/null
+++ b/lib/loading/index.wxml
@@ -0,0 +1,16 @@
+
+
+
+
+
diff --git a/lib/loading/index.wxss b/lib/loading/index.wxss
new file mode 100644
index 00000000..58cb52ae
--- /dev/null
+++ b/lib/loading/index.wxss
@@ -0,0 +1 @@
+@import '../common/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;-webkit-animation:van-rotate .8s linear infinite;animation:van-rotate .8s linear infinite}.van-loading__spinner--spinner{-webkit-animation-timing-function:steps(12);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;-webkit-transform:rotate(30deg);transform:rotate(30deg)}.van-loading__dot:nth-of-type(2){opacity:.9375;-webkit-transform:rotate(60deg);transform:rotate(60deg)}.van-loading__dot:nth-of-type(3){opacity:.875;-webkit-transform:rotate(90deg);transform:rotate(90deg)}.van-loading__dot:nth-of-type(4){opacity:.8125;-webkit-transform:rotate(120deg);transform:rotate(120deg)}.van-loading__dot:nth-of-type(5){opacity:.75;-webkit-transform:rotate(150deg);transform:rotate(150deg)}.van-loading__dot:nth-of-type(6){opacity:.6875;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.van-loading__dot:nth-of-type(7){opacity:.625;-webkit-transform:rotate(210deg);transform:rotate(210deg)}.van-loading__dot:nth-of-type(8){opacity:.5625;-webkit-transform:rotate(240deg);transform:rotate(240deg)}.van-loading__dot:nth-of-type(9){opacity:.5;-webkit-transform:rotate(270deg);transform:rotate(270deg)}.van-loading__dot:nth-of-type(10){opacity:.4375;-webkit-transform:rotate(300deg);transform:rotate(300deg)}.van-loading__dot:nth-of-type(11){opacity:.375;-webkit-transform:rotate(330deg);transform:rotate(330deg)}.van-loading__dot:nth-of-type(12){opacity:.3125;-webkit-transform:rotate(1turn);transform:rotate(1turn)}@-webkit-keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}
\ No newline at end of file
diff --git a/lib/mixins/basic.js b/lib/mixins/basic.js
new file mode 100644
index 00000000..ae9f3440
--- /dev/null
+++ b/lib/mixins/basic.js
@@ -0,0 +1,25 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.basic = Behavior({
+ methods: {
+ $emit: function () {
+ this.triggerEvent.apply(this, arguments);
+ },
+ getRect: function (selector, all) {
+ var _this = this;
+ return new Promise(function (resolve) {
+ wx.createSelectorQuery()
+ .in(_this)[all ? 'selectAll' : 'select'](selector)
+ .boundingClientRect(function (rect) {
+ if (all && Array.isArray(rect) && rect.length) {
+ resolve(rect);
+ }
+ if (!all && rect) {
+ resolve(rect);
+ }
+ })
+ .exec();
+ });
+ }
+ }
+});
diff --git a/lib/mixins/button.js b/lib/mixins/button.js
new file mode 100644
index 00000000..af488740
--- /dev/null
+++ b/lib/mixins/button.js
@@ -0,0 +1,20 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+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
+ }
+});
diff --git a/lib/mixins/link.js b/lib/mixins/link.js
new file mode 100644
index 00000000..b2b81dcd
--- /dev/null
+++ b/lib/mixins/link.js
@@ -0,0 +1,20 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.link = Behavior({
+ properties: {
+ url: String,
+ linkType: {
+ type: String,
+ value: 'navigateTo'
+ }
+ },
+ methods: {
+ jumpLink: function (urlKey) {
+ if (urlKey === void 0) { urlKey = 'url'; }
+ var url = this.data[urlKey];
+ if (url) {
+ wx[this.data.linkType]({ url: url });
+ }
+ }
+ }
+});
diff --git a/lib/mixins/observer/behavior.js b/lib/mixins/observer/behavior.js
new file mode 100644
index 00000000..01afb7d7
--- /dev/null
+++ b/lib/mixins/observer/behavior.js
@@ -0,0 +1,51 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+function setAsync(context, data) {
+ return new Promise(function (resolve) {
+ context.setData(data, resolve);
+ });
+}
+;
+exports.behavior = Behavior({
+ created: function () {
+ var _this = this;
+ if (!this.$options) {
+ return;
+ }
+ var cache = {};
+ var computed = this.$options().computed;
+ var keys = Object.keys(computed);
+ this.calcComputed = function () {
+ var needUpdate = {};
+ keys.forEach(function (key) {
+ var value = computed[key].call(_this);
+ if (cache[key] !== value) {
+ cache[key] = needUpdate[key] = value;
+ }
+ });
+ return needUpdate;
+ };
+ },
+ attached: function () {
+ this.set();
+ },
+ methods: {
+ // set data and set computed data
+ set: function (data, callback) {
+ var _this = this;
+ var stack = [];
+ if (data) {
+ stack.push(setAsync(this, data));
+ }
+ if (this.calcComputed) {
+ stack.push(setAsync(this, this.calcComputed()));
+ }
+ return Promise.all(stack).then(function (res) {
+ if (callback && typeof callback === 'function') {
+ callback.call(_this);
+ }
+ return res;
+ });
+ }
+ }
+});
diff --git a/lib/mixins/observer/index.js b/lib/mixins/observer/index.js
new file mode 100644
index 00000000..55968714
--- /dev/null
+++ b/lib/mixins/observer/index.js
@@ -0,0 +1,30 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var behavior_1 = require("./behavior");
+var props_1 = require("./props");
+function observe(vantOptions, options) {
+ var watch = vantOptions.watch, computed = vantOptions.computed;
+ options.behaviors.push(behavior_1.behavior);
+ if (watch) {
+ var props_2 = options.properties || {};
+ Object.keys(watch).forEach(function (key) {
+ if (key in props_2) {
+ var prop = props_2[key];
+ if (prop === null || !('type' in prop)) {
+ prop = { type: prop };
+ }
+ prop.observer = watch[key];
+ props_2[key] = prop;
+ }
+ });
+ options.properties = props_2;
+ }
+ if (computed) {
+ options.methods = options.methods || {};
+ options.methods.$options = function () { return vantOptions; };
+ if (options.properties) {
+ props_1.observeProps(options.properties);
+ }
+ }
+}
+exports.observe = observe;
diff --git a/lib/mixins/observer/props.js b/lib/mixins/observer/props.js
new file mode 100644
index 00000000..61f0b9c8
--- /dev/null
+++ b/lib/mixins/observer/props.js
@@ -0,0 +1,25 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+function observeProps(props) {
+ if (!props) {
+ return;
+ }
+ Object.keys(props).forEach(function (key) {
+ var prop = props[key];
+ if (prop === null || !('type' in prop)) {
+ prop = { type: prop };
+ }
+ var observer = prop.observer;
+ prop.observer = function () {
+ if (observer) {
+ if (typeof observer === 'string') {
+ observer = this[observer];
+ }
+ observer.apply(this, arguments);
+ }
+ this.set();
+ };
+ props[key] = prop;
+ });
+}
+exports.observeProps = observeProps;
diff --git a/lib/mixins/open-type.js b/lib/mixins/open-type.js
new file mode 100644
index 00000000..765989bf
--- /dev/null
+++ b/lib/mixins/open-type.js
@@ -0,0 +1,27 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.openType = Behavior({
+ properties: {
+ openType: String
+ },
+ methods: {
+ bindGetUserInfo: function (event) {
+ this.$emit('getuserinfo', event.detail);
+ },
+ bindContact: function (event) {
+ this.$emit('contact', event.detail);
+ },
+ bindGetPhoneNumber: function (event) {
+ this.$emit('getphonenumber', event.detail);
+ },
+ bindError: function (event) {
+ this.$emit('error', event.detail);
+ },
+ bindLaunchApp: function (event) {
+ this.$emit('launchapp', event.detail);
+ },
+ bindOpenSetting: function (event) {
+ this.$emit('opensetting', event.detail);
+ },
+ }
+});
diff --git a/lib/mixins/safe-area.js b/lib/mixins/safe-area.js
new file mode 100644
index 00000000..bccfede5
--- /dev/null
+++ b/lib/mixins/safe-area.js
@@ -0,0 +1,47 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var cache = null;
+function getSafeArea() {
+ return new Promise(function (resolve, reject) {
+ if (cache != null) {
+ resolve(cache);
+ }
+ else {
+ wx.getSystemInfo({
+ success: function (_a) {
+ var model = _a.model, screenHeight = _a.screenHeight, statusBarHeight = _a.statusBarHeight;
+ var iphoneX = /iphone x/i.test(model);
+ var iphoneNew = /iPhone11/i.test(model) && screenHeight === 812;
+ cache = {
+ isIPhoneX: iphoneX || iphoneNew,
+ statusBarHeight: statusBarHeight
+ };
+ resolve(cache);
+ },
+ fail: reject
+ });
+ }
+ });
+}
+exports.safeArea = function (_a) {
+ var _b = _a === void 0 ? {} : _a, _c = _b.safeAreaInsetBottom, safeAreaInsetBottom = _c === void 0 ? true : _c, _d = _b.safeAreaInsetTop, safeAreaInsetTop = _d === void 0 ? false : _d;
+ return Behavior({
+ properties: {
+ safeAreaInsetTop: {
+ type: Boolean,
+ value: safeAreaInsetTop
+ },
+ safeAreaInsetBottom: {
+ type: Boolean,
+ value: safeAreaInsetBottom
+ }
+ },
+ created: function () {
+ var _this = this;
+ getSafeArea().then(function (_a) {
+ var isIPhoneX = _a.isIPhoneX, statusBarHeight = _a.statusBarHeight;
+ _this.set({ isIPhoneX: isIPhoneX, statusBarHeight: statusBarHeight });
+ });
+ }
+ });
+};
diff --git a/lib/mixins/touch.js b/lib/mixins/touch.js
new file mode 100644
index 00000000..37d18c98
--- /dev/null
+++ b/lib/mixins/touch.js
@@ -0,0 +1,23 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.touch = Behavior({
+ methods: {
+ touchStart: function (event) {
+ this.direction = '';
+ this.deltaX = 0;
+ this.deltaY = 0;
+ this.offsetX = 0;
+ this.offsetY = 0;
+ this.startX = event.touches[0].clientX;
+ this.startY = event.touches[0].clientY;
+ },
+ touchMove: function (event) {
+ var touch = event.touches[0];
+ this.deltaX = touch.clientX - this.startX;
+ this.deltaY = touch.clientY - this.startY;
+ this.offsetX = Math.abs(this.deltaX);
+ this.offsetY = Math.abs(this.deltaY);
+ this.direction = this.offsetX > this.offsetY ? 'horizontal' : this.offsetX < this.offsetY ? 'vertical' : '';
+ }
+ }
+});
diff --git a/lib/mixins/transition.js b/lib/mixins/transition.js
new file mode 100644
index 00000000..162726f2
--- /dev/null
+++ b/lib/mixins/transition.js
@@ -0,0 +1,108 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var utils_1 = require("../common/utils");
+var getClassNames = function (name) { return ({
+ enter: "van-" + name + "-enter van-" + name + "-enter-active enter-class enter-active-class",
+ 'enter-to': "van-" + name + "-enter-to van-" + name + "-enter-active enter-to-class enter-active-class",
+ leave: "van-" + name + "-leave van-" + name + "-leave-active leave-class leave-active-class",
+ 'leave-to': "van-" + name + "-leave-to van-" + name + "-leave-active leave-to-class leave-active-class"
+}); };
+var nextTick = function () { return new Promise(function (resolve) { return setTimeout(resolve, 1000 / 30); }); };
+exports.transition = function (showDefaultValue) {
+ return Behavior({
+ properties: {
+ customStyle: String,
+ show: {
+ type: Boolean,
+ value: showDefaultValue,
+ observer: 'observeShow'
+ },
+ duration: {
+ type: [Number, Object],
+ value: 300,
+ observer: 'observeDuration'
+ },
+ name: {
+ type: String,
+ value: 'fade',
+ observer: 'updateClasses'
+ }
+ },
+ data: {
+ type: '',
+ inited: false,
+ display: false,
+ classNames: getClassNames('fade')
+ },
+ attached: function () {
+ if (this.data.show) {
+ this.show();
+ }
+ },
+ methods: {
+ observeShow: function (value) {
+ if (value) {
+ this.show();
+ }
+ else {
+ this.leave();
+ }
+ },
+ updateClasses: function (name) {
+ this.set({
+ classNames: getClassNames(name)
+ });
+ },
+ show: function () {
+ var _this = this;
+ var _a = this.data, classNames = _a.classNames, duration = _a.duration;
+ var currentDuration = utils_1.isObj(duration) ? duration.leave : duration;
+ Promise.resolve()
+ .then(nextTick)
+ .then(function () {
+ return _this.set({
+ inited: true,
+ display: true,
+ classes: classNames.enter,
+ currentDuration: currentDuration
+ });
+ })
+ .then(nextTick)
+ .then(function () {
+ return _this.set({
+ classes: classNames['enter-to']
+ });
+ });
+ },
+ leave: function () {
+ var _this = this;
+ var _a = this.data, classNames = _a.classNames, duration = _a.duration;
+ var currentDuration = utils_1.isObj(duration) ? duration.leave : duration;
+ if (+currentDuration === 0) {
+ this.onTransitionEnd();
+ return;
+ }
+ Promise.resolve()
+ .then(nextTick)
+ .then(function () {
+ return _this.set({
+ classes: classNames.leave,
+ currentDuration: currentDuration
+ });
+ })
+ .then(nextTick)
+ .then(function () {
+ return _this.set({
+ classes: classNames['leave-to']
+ });
+ });
+ },
+ onTransitionEnd: function () {
+ if (!this.data.show) {
+ this.set({ display: false });
+ this.$emit('transitionEnd');
+ }
+ }
+ }
+ });
+};
diff --git a/lib/nav-bar/index.js b/lib/nav-bar/index.js
new file mode 100644
index 00000000..830e527c
--- /dev/null
+++ b/lib/nav-bar/index.js
@@ -0,0 +1,31 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var safe_area_1 = require("../mixins/safe-area");
+component_1.VantComponent({
+ mixins: [safe_area_1.safeArea({ safeAreaInsetTop: true })],
+ classes: ['title-class'],
+ props: {
+ title: String,
+ fixed: Boolean,
+ leftText: String,
+ rightText: String,
+ leftArrow: Boolean,
+ border: {
+ type: Boolean,
+ value: true
+ },
+ zIndex: {
+ type: Number,
+ value: 120
+ }
+ },
+ methods: {
+ onClickLeft: function () {
+ this.$emit('click-left');
+ },
+ onClickRight: function () {
+ this.$emit('click-right');
+ }
+ }
+});
diff --git a/lib/nav-bar/index.json b/lib/nav-bar/index.json
new file mode 100644
index 00000000..0a336c08
--- /dev/null
+++ b/lib/nav-bar/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index"
+ }
+}
diff --git a/lib/nav-bar/index.wxml b/lib/nav-bar/index.wxml
new file mode 100644
index 00000000..2f235b5a
--- /dev/null
+++ b/lib/nav-bar/index.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+ {{ leftText }}
+
+
+
+
+ {{ title }}
+
+
+
+ {{ rightText }}
+
+
+
diff --git a/lib/nav-bar/index.wxss b/lib/nav-bar/index.wxss
new file mode 100644
index 00000000..8f576d3c
--- /dev/null
+++ b/lib/nav-bar/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-nav-bar{position:relative;height:44px;line-height:44px;text-align:center;background-color:#fff;-webkit-user-select:none;user-select:none}.van-nav-bar__text{display:inline-block;padding:0 15px;margin:0 -15px;color:#1989fa;vertical-align:middle}.van-nav-bar__text--hover{background-color:#f2f3f5}.van-nav-bar__arrow{color:#1989fa;vertical-align:middle}.van-nav-bar__arrow+.van-nav-bar__text{padding-left:25px;margin-left:-20px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;font-size:16px;font-weight:500}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;font-size:14px}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}
\ No newline at end of file
diff --git a/lib/notice-bar/index.js b/lib/notice-bar/index.js
new file mode 100644
index 00000000..08f1b495
--- /dev/null
+++ b/lib/notice-bar/index.js
@@ -0,0 +1,132 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var FONT_COLOR = '#ed6a0c';
+var BG_COLOR = '#fffbe8';
+component_1.VantComponent({
+ props: {
+ text: {
+ type: String,
+ value: ''
+ },
+ mode: {
+ type: String,
+ value: ''
+ },
+ url: {
+ type: String,
+ value: ''
+ },
+ openType: {
+ type: String,
+ value: 'navigate'
+ },
+ delay: {
+ type: Number,
+ value: 0
+ },
+ speed: {
+ type: Number,
+ value: 50
+ },
+ scrollable: {
+ type: Boolean,
+ value: true
+ },
+ leftIcon: {
+ type: String,
+ value: ''
+ },
+ color: {
+ type: String,
+ value: FONT_COLOR
+ },
+ backgroundColor: {
+ type: String,
+ value: BG_COLOR
+ }
+ },
+ data: {
+ show: true,
+ hasRightIcon: false
+ },
+ watch: {
+ text: function () {
+ this.set({}, this.init);
+ }
+ },
+ created: function () {
+ if (this.data.mode) {
+ this.set({
+ hasRightIcon: true
+ });
+ }
+ this.resetAnimation = wx.createAnimation({
+ duration: 0,
+ timingFunction: 'linear'
+ });
+ },
+ destroyed: function () {
+ this.timer && clearTimeout(this.timer);
+ },
+ methods: {
+ init: function () {
+ var _this = this;
+ Promise.all([
+ this.getRect('.van-notice-bar__content'),
+ this.getRect('.van-notice-bar__content-wrap')
+ ]).then(function (rects) {
+ var contentRect = rects[0], wrapRect = rects[1];
+ if (contentRect == null ||
+ wrapRect == null ||
+ !contentRect.width ||
+ !wrapRect.width) {
+ return;
+ }
+ var _a = _this.data, speed = _a.speed, scrollable = _a.scrollable, delay = _a.delay;
+ if (scrollable && wrapRect.width < contentRect.width) {
+ var duration = (contentRect.width / speed) * 1000;
+ _this.wrapWidth = wrapRect.width;
+ _this.contentWidth = contentRect.width;
+ _this.duration = duration;
+ _this.animation = wx.createAnimation({
+ duration: duration,
+ timingFunction: 'linear',
+ delay: delay
+ });
+ _this.scroll();
+ }
+ });
+ },
+ scroll: function () {
+ var _this = this;
+ this.timer && clearTimeout(this.timer);
+ this.timer = null;
+ this.set({
+ animationData: this.resetAnimation
+ .translateX(this.wrapWidth)
+ .step()
+ .export()
+ });
+ setTimeout(function () {
+ _this.set({
+ animationData: _this.animation
+ .translateX(-_this.contentWidth)
+ .step()
+ .export()
+ });
+ }, 20);
+ this.timer = setTimeout(function () {
+ _this.scroll();
+ }, this.duration);
+ },
+ onClickIcon: function () {
+ this.timer && clearTimeout(this.timer);
+ this.timer = null;
+ this.set({ show: false });
+ },
+ onClick: function (event) {
+ this.$emit('click', event);
+ }
+ }
+});
diff --git a/lib/notice-bar/index.json b/lib/notice-bar/index.json
new file mode 100644
index 00000000..a9ab393a
--- /dev/null
+++ b/lib/notice-bar/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index"
+ }
+}
\ No newline at end of file
diff --git a/lib/notice-bar/index.wxml b/lib/notice-bar/index.wxml
new file mode 100644
index 00000000..d391ad95
--- /dev/null
+++ b/lib/notice-bar/index.wxml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ {{ text }}
+
+
+
+
+
+
+
+
diff --git a/lib/notice-bar/index.wxss b/lib/notice-bar/index.wxss
new file mode 100644
index 00000000..f6a39609
--- /dev/null
+++ b/lib/notice-bar/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-notice-bar{display:-webkit-flex;display:flex;height:40px;padding:0 15px;font-size:14px;line-height:24px;-webkit-align-items:center;align-items:center}.van-notice-bar--within-icon{position:relative;padding-right:40px}.van-notice-bar__left-icon{height:18px;min-width:20px;box-sizing:border-box}.van-notice-bar__left-icon>image{width:16px;height:16px}.van-notice-bar__right-icon{position:absolute;top:10px;right:15px;font-size:16px}.van-notice-bar__content-wrap{position:relative;height:24px;overflow:hidden;-webkit-flex:1;flex:1}.van-notice-bar__content{position:absolute;white-space:nowrap}.van-notice-bar__content.van-ellipsis{max-width:100%}
\ No newline at end of file
diff --git a/lib/notify/index.js b/lib/notify/index.js
new file mode 100644
index 00000000..3b8b4db9
--- /dev/null
+++ b/lib/notify/index.js
@@ -0,0 +1,44 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var color_1 = require("../common/color");
+var safe_area_1 = require("../mixins/safe-area");
+component_1.VantComponent({
+ mixins: [safe_area_1.safeArea()],
+ props: {
+ text: String,
+ color: {
+ type: String,
+ value: '#fff'
+ },
+ backgroundColor: {
+ type: String,
+ value: color_1.RED
+ },
+ duration: {
+ type: Number,
+ value: 3000
+ }
+ },
+ methods: {
+ show: function () {
+ var _this = this;
+ var duration = this.data.duration;
+ clearTimeout(this.timer);
+ this.set({
+ show: true
+ });
+ if (duration > 0 && duration !== Infinity) {
+ this.timer = setTimeout(function () {
+ _this.hide();
+ }, duration);
+ }
+ },
+ hide: function () {
+ clearTimeout(this.timer);
+ this.set({
+ show: false
+ });
+ }
+ }
+});
diff --git a/lib/notify/index.json b/lib/notify/index.json
new file mode 100644
index 00000000..c14a65f6
--- /dev/null
+++ b/lib/notify/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-transition": "../transition/index"
+ }
+}
diff --git a/lib/notify/index.wxml b/lib/notify/index.wxml
new file mode 100644
index 00000000..4f480eaa
--- /dev/null
+++ b/lib/notify/index.wxml
@@ -0,0 +1,9 @@
+
+
+ {{ text }}
+
diff --git a/lib/notify/index.wxss b/lib/notify/index.wxss
new file mode 100644
index 00000000..de9b6203
--- /dev/null
+++ b/lib/notify/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-notify{position:fixed;top:0;z-index:110;width:100%;padding:6px 15px;font-size:14px;line-height:20px;text-align:center;word-break:break-all;box-sizing:border-box}.van-notify__safe-top{height:44px}
\ No newline at end of file
diff --git a/lib/notify/notify.js b/lib/notify/notify.js
new file mode 100644
index 00000000..621aefd4
--- /dev/null
+++ b/lib/notify/notify.js
@@ -0,0 +1,28 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var utils_1 = require("../common/utils");
+var defaultOptions = {
+ selector: '#van-notify',
+ duration: 3000
+};
+function parseOptions(text) {
+ return utils_1.isObj(text) ? text : { text: text };
+}
+function getContext() {
+ var pages = getCurrentPages();
+ return pages[pages.length - 1];
+}
+function Notify(options) {
+ options = Object.assign({}, defaultOptions, parseOptions(options));
+ var context = options.context || getContext();
+ var notify = context.selectComponent(options.selector);
+ delete options.selector;
+ if (notify) {
+ notify.set(options);
+ notify.show();
+ }
+ else {
+ console.warn('未找到 van-notify 节点,请确认 selector 及 context 是否正确');
+ }
+}
+exports.default = Notify;
diff --git a/lib/overlay/index.js b/lib/overlay/index.js
new file mode 100644
index 00000000..65c9334f
--- /dev/null
+++ b/lib/overlay/index.js
@@ -0,0 +1,25 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ props: {
+ show: Boolean,
+ mask: Boolean,
+ customStyle: String,
+ duration: {
+ type: [Number, Object],
+ value: 300
+ },
+ zIndex: {
+ type: Number,
+ value: 1
+ }
+ },
+ methods: {
+ onClick: function () {
+ this.$emit('click');
+ },
+ // for prevent touchmove
+ noop: function () { }
+ }
+});
diff --git a/lib/overlay/index.json b/lib/overlay/index.json
new file mode 100644
index 00000000..c14a65f6
--- /dev/null
+++ b/lib/overlay/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-transition": "../transition/index"
+ }
+}
diff --git a/lib/overlay/index.wxml b/lib/overlay/index.wxml
new file mode 100644
index 00000000..31d222e4
--- /dev/null
+++ b/lib/overlay/index.wxml
@@ -0,0 +1,8 @@
+
diff --git a/lib/overlay/index.wxss b/lib/overlay/index.wxss
new file mode 100644
index 00000000..d4a466c9
--- /dev/null
+++ b/lib/overlay/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-overlay{position:fixed;top:0;right:0;bottom:0;left:0}
\ No newline at end of file
diff --git a/lib/panel/index.js b/lib/panel/index.js
new file mode 100644
index 00000000..a3ec0034
--- /dev/null
+++ b/lib/panel/index.js
@@ -0,0 +1,12 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ classes: ['header-class', 'footer-class'],
+ props: {
+ desc: String,
+ title: String,
+ status: String,
+ useFooterSlot: Boolean
+ }
+});
diff --git a/lib/panel/index.json b/lib/panel/index.json
new file mode 100644
index 00000000..0e5425cd
--- /dev/null
+++ b/lib/panel/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-cell": "../cell/index"
+ }
+}
diff --git a/lib/panel/index.wxml b/lib/panel/index.wxml
new file mode 100644
index 00000000..3f135d23
--- /dev/null
+++ b/lib/panel/index.wxml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/panel/index.wxss b/lib/panel/index.wxss
new file mode 100644
index 00000000..79d4af79
--- /dev/null
+++ b/lib/panel/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-panel{background:#fff}.van-panel__header-value{color:#f44}.van-panel__footer{padding:10px 15px}
\ No newline at end of file
diff --git a/lib/picker-column/index.js b/lib/picker-column/index.js
new file mode 100644
index 00000000..3e1cef0d
--- /dev/null
+++ b/lib/picker-column/index.js
@@ -0,0 +1,140 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var utils_1 = require("../common/utils");
+var DEFAULT_DURATION = 200;
+component_1.VantComponent({
+ classes: ['active-class'],
+ props: {
+ valueKey: String,
+ className: String,
+ itemHeight: Number,
+ visibleItemCount: Number,
+ initialOptions: {
+ type: Array,
+ value: []
+ },
+ defaultIndex: {
+ type: Number,
+ value: 0
+ }
+ },
+ data: {
+ startY: 0,
+ offset: 0,
+ duration: 0,
+ startOffset: 0,
+ options: [],
+ currentIndex: 0
+ },
+ created: function () {
+ var _this = this;
+ var _a = this.data, defaultIndex = _a.defaultIndex, initialOptions = _a.initialOptions;
+ this.set({
+ currentIndex: defaultIndex,
+ options: initialOptions
+ }).then(function () {
+ _this.setIndex(defaultIndex);
+ });
+ },
+ computed: {
+ count: function () {
+ return this.data.options.length;
+ },
+ baseOffset: function () {
+ var data = this.data;
+ return (data.itemHeight * (data.visibleItemCount - 1)) / 2;
+ },
+ wrapperStyle: function () {
+ var data = this.data;
+ return [
+ "transition: " + data.duration + "ms",
+ "transform: translate3d(0, " + (data.offset + data.baseOffset) + "px, 0)",
+ "line-height: " + data.itemHeight + "px"
+ ].join('; ');
+ }
+ },
+ watch: {
+ defaultIndex: function (value) {
+ this.setIndex(value);
+ }
+ },
+ methods: {
+ onTouchStart: function (event) {
+ this.set({
+ startY: event.touches[0].clientY,
+ startOffset: this.data.offset,
+ duration: 0
+ });
+ },
+ onTouchMove: function (event) {
+ var data = this.data;
+ var deltaY = event.touches[0].clientY - data.startY;
+ this.set({
+ offset: utils_1.range(data.startOffset + deltaY, -(data.count * data.itemHeight), data.itemHeight)
+ });
+ },
+ onTouchEnd: function () {
+ var data = this.data;
+ if (data.offset !== data.startOffset) {
+ this.set({
+ duration: DEFAULT_DURATION
+ });
+ var index = utils_1.range(Math.round(-data.offset / data.itemHeight), 0, data.count - 1);
+ this.setIndex(index, true);
+ }
+ },
+ onClickItem: function (event) {
+ var index = event.currentTarget.dataset.index;
+ this.setIndex(index, true);
+ },
+ adjustIndex: function (index) {
+ var data = this.data;
+ index = utils_1.range(index, 0, data.count);
+ for (var i = index; i < data.count; i++) {
+ if (!this.isDisabled(data.options[i]))
+ return i;
+ }
+ for (var i = index - 1; i >= 0; i--) {
+ if (!this.isDisabled(data.options[i]))
+ return i;
+ }
+ },
+ isDisabled: function (option) {
+ return utils_1.isObj(option) && option.disabled;
+ },
+ getOptionText: function (option) {
+ var data = this.data;
+ return utils_1.isObj(option) && data.valueKey in option
+ ? option[data.valueKey]
+ : option;
+ },
+ setIndex: function (index, userAction) {
+ var _this = this;
+ var data = this.data;
+ index = this.adjustIndex(index) || 0;
+ var offset = -index * data.itemHeight;
+ if (index !== data.currentIndex) {
+ return this.set({ offset: offset, currentIndex: index }).then(function () {
+ userAction && _this.$emit('change', index);
+ });
+ }
+ else {
+ return this.set({ offset: offset });
+ }
+ },
+ setValue: function (value) {
+ var options = this.data.options;
+ for (var i = 0; i < options.length; i++) {
+ if (this.getOptionText(options[i]) === value) {
+ return this.setIndex(i);
+ }
+ }
+ return Promise.resolve();
+ },
+ getValue: function () {
+ var data = this.data;
+ return data.options[data.currentIndex];
+ }
+ }
+});
diff --git a/lib/picker-column/index.json b/lib/picker-column/index.json
new file mode 100644
index 00000000..32640e0d
--- /dev/null
+++ b/lib/picker-column/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
\ No newline at end of file
diff --git a/lib/picker-column/index.wxml b/lib/picker-column/index.wxml
new file mode 100644
index 00000000..d0ecb33c
--- /dev/null
+++ b/lib/picker-column/index.wxml
@@ -0,0 +1,31 @@
+
+
+ {{ getOptionText(option, valueKey) }}
+
+
+
+
+function isObj(x) {
+ var type = typeof x;
+ return x !== null && (type === 'object' || type === 'function');
+}
+
+module.exports = function (option, valueKey) {
+ return isObj(option) && option[valueKey] ? option[valueKey] : option;
+}
+
diff --git a/lib/picker-column/index.wxss b/lib/picker-column/index.wxss
new file mode 100644
index 00000000..b39acdc8
--- /dev/null
+++ b/lib/picker-column/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-picker-column{overflow:hidden;font-size:16px;text-align:center}.van-picker-column__item{padding:0 5px;color:#999}.van-picker-column__item--selected{font-weight:500;color:#333}.van-picker-column__item--disabled{opacity:.3}
\ No newline at end of file
diff --git a/lib/picker/index.js b/lib/picker/index.js
new file mode 100644
index 00000000..16787579
--- /dev/null
+++ b/lib/picker/index.js
@@ -0,0 +1,160 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+function isSimple(columns) {
+ return columns.length && !columns[0].values;
+}
+component_1.VantComponent({
+ classes: ['active-class', 'toolbar-class', 'column-class'],
+ props: {
+ title: String,
+ loading: Boolean,
+ showToolbar: Boolean,
+ confirmButtonText: String,
+ cancelButtonText: String,
+ visibleItemCount: {
+ type: Number,
+ value: 5
+ },
+ valueKey: {
+ type: String,
+ value: 'text'
+ },
+ itemHeight: {
+ type: Number,
+ value: 44
+ },
+ columns: {
+ type: Array,
+ value: [],
+ observer: function (columns) {
+ if (columns === void 0) { columns = []; }
+ this.simple = isSimple(columns);
+ this.children = this.selectAllComponents('.van-picker__column');
+ if (Array.isArray(this.children) && this.children.length) {
+ this.setColumns().catch(function () { });
+ }
+ }
+ }
+ },
+ beforeCreate: function () {
+ this.children = [];
+ },
+ methods: {
+ noop: function () { },
+ setColumns: function () {
+ var _this = this;
+ var data = this.data;
+ var columns = this.simple ? [{ values: data.columns }] : data.columns;
+ var stack = columns.map(function (column, index) {
+ return _this.setColumnValues(index, column.values);
+ });
+ return Promise.all(stack);
+ },
+ emit: function (event) {
+ var type = event.currentTarget.dataset.type;
+ if (this.simple) {
+ this.$emit(type, {
+ value: this.getColumnValue(0),
+ index: this.getColumnIndex(0)
+ });
+ }
+ else {
+ this.$emit(type, {
+ value: this.getValues(),
+ index: this.getIndexes()
+ });
+ }
+ },
+ onChange: function (event) {
+ if (this.simple) {
+ this.$emit('change', {
+ picker: this,
+ value: this.getColumnValue(0),
+ index: this.getColumnIndex(0)
+ });
+ }
+ else {
+ this.$emit('change', {
+ picker: this,
+ value: this.getValues(),
+ index: event.currentTarget.dataset.index
+ });
+ }
+ },
+ // get column instance by index
+ getColumn: function (index) {
+ return this.children[index];
+ },
+ // get column value by index
+ getColumnValue: function (index) {
+ var column = this.getColumn(index);
+ return column && column.getValue();
+ },
+ // set column value by index
+ setColumnValue: function (index, value) {
+ var column = this.getColumn(index);
+ if (column == null) {
+ return Promise.reject('setColumnValue: 对应列不存在');
+ }
+ return column.setValue(value);
+ },
+ // get column option index by column index
+ getColumnIndex: function (columnIndex) {
+ return (this.getColumn(columnIndex) || {}).data.currentIndex;
+ },
+ // set column option index by column index
+ setColumnIndex: function (columnIndex, optionIndex) {
+ var column = this.getColumn(columnIndex);
+ if (column == null) {
+ return Promise.reject('setColumnIndex: 对应列不存在');
+ }
+ return column.setIndex(optionIndex);
+ },
+ // get options of column by index
+ getColumnValues: function (index) {
+ return (this.children[index] || {}).data.options;
+ },
+ // set options of column by index
+ setColumnValues: function (index, options, needReset) {
+ if (needReset === void 0) { needReset = true; }
+ var column = this.children[index];
+ if (column == null) {
+ return Promise.reject('setColumnValues: 对应列不存在');
+ }
+ var isSame = JSON.stringify(column.data.options) === JSON.stringify(options);
+ if (isSame) {
+ return Promise.resolve();
+ }
+ return column.set({ options: options }).then(function () {
+ if (needReset) {
+ column.setIndex(0);
+ }
+ });
+ },
+ // get values of all columns
+ getValues: function () {
+ return this.children.map(function (child) { return child.getValue(); });
+ },
+ // set values of all columns
+ setValues: function (values) {
+ var _this = this;
+ var stack = values.map(function (value, index) {
+ return _this.setColumnValue(index, value);
+ });
+ return Promise.all(stack);
+ },
+ // get indexes of all columns
+ getIndexes: function () {
+ return this.children.map(function (child) { return child.data.currentIndex; });
+ },
+ // set indexes of all columns
+ setIndexes: function (indexes) {
+ var _this = this;
+ var stack = indexes.map(function (optionIndex, columnIndex) {
+ return _this.setColumnIndex(columnIndex, optionIndex);
+ });
+ return Promise.all(stack);
+ }
+ }
+});
diff --git a/lib/picker/index.json b/lib/picker/index.json
new file mode 100644
index 00000000..2fcec899
--- /dev/null
+++ b/lib/picker/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "picker-column": "../picker-column/index",
+ "loading": "../loading/index"
+ }
+}
diff --git a/lib/picker/index.wxml b/lib/picker/index.wxml
new file mode 100644
index 00000000..5bc4b9c8
--- /dev/null
+++ b/lib/picker/index.wxml
@@ -0,0 +1,60 @@
+
+
+
+ {{ cancelButtonText || '取消' }}
+
+ {{ title }}
+
+ {{ confirmButtonText || '确认' }}
+
+
+
+
+
+
+
+
+
+
+
+
+ function isSimple(columns) {
+ return columns.length && !columns[0].values;
+ }
+ module.exports = isSimple;
+
diff --git a/lib/picker/index.wxss b/lib/picker/index.wxss
new file mode 100644
index 00000000..a054f3c5
--- /dev/null
+++ b/lib/picker/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-picker{position:relative;overflow:hidden;-webkit-text-size-adjust:100%;background-color:#fff;-webkit-user-select:none;user-select:none}.van-picker__toolbar{display:-webkit-flex;display:flex;height:44px;line-height:44px;-webkit-justify-content:space-between;justify-content:space-between}.van-picker__cancel,.van-picker__confirm{padding:0 15px;font-size:14px;color:#1989fa}.van-picker__cancel--hover,.van-picker__confirm--hover{background-color:#f2f3f5}.van-picker__title{max-width:50%;font-size:16px;font-weight:500;text-align:center}.van-picker__columns{position:relative;display:-webkit-flex;display:flex}.van-picker__column{-webkit-flex:1 1;flex:1 1;width:0}.van-picker__loading{position:absolute;top:0;right:0;bottom:0;left:0;z-index:4;display:-webkit-flex;display:flex;background-color:hsla(0,0%,100%,.9);-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-picker__frame,.van-picker__loading .van-loading{position:absolute;top:50%;left:0;z-index:1;width:100%;pointer-events:none;-webkit-transform:translateY(-50%);transform:translateY(-50%)}
\ No newline at end of file
diff --git a/lib/popup/index.js b/lib/popup/index.js
new file mode 100644
index 00000000..8a32525a
--- /dev/null
+++ b/lib/popup/index.js
@@ -0,0 +1,59 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var transition_1 = require("../mixins/transition");
+var safe_area_1 = require("../mixins/safe-area");
+component_1.VantComponent({
+ classes: [
+ 'enter-class',
+ 'enter-active-class',
+ 'enter-to-class',
+ 'leave-class',
+ 'leave-active-class',
+ 'leave-to-class'
+ ],
+ mixins: [transition_1.transition(false), safe_area_1.safeArea()],
+ props: {
+ transition: {
+ type: String,
+ observer: 'observeClass'
+ },
+ customStyle: String,
+ overlayStyle: String,
+ zIndex: {
+ type: Number,
+ value: 100
+ },
+ overlay: {
+ type: Boolean,
+ value: true
+ },
+ closeOnClickOverlay: {
+ type: Boolean,
+ value: true
+ },
+ position: {
+ type: String,
+ value: 'center',
+ observer: 'observeClass'
+ }
+ },
+ created: function () {
+ this.observeClass();
+ },
+ methods: {
+ onClickOverlay: function () {
+ this.$emit('click-overlay');
+ if (this.data.closeOnClickOverlay) {
+ this.$emit('close');
+ }
+ },
+ observeClass: function () {
+ var _a = this.data, transition = _a.transition, position = _a.position;
+ this.updateClasses(transition || position);
+ if (transition === 'none') {
+ this.set({ duration: 0 });
+ }
+ }
+ }
+});
diff --git a/lib/popup/index.json b/lib/popup/index.json
new file mode 100644
index 00000000..0dd2931d
--- /dev/null
+++ b/lib/popup/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-overlay": "../overlay/index"
+ }
+}
diff --git a/lib/popup/index.wxml b/lib/popup/index.wxml
new file mode 100644
index 00000000..9c53b381
--- /dev/null
+++ b/lib/popup/index.wxml
@@ -0,0 +1,20 @@
+
+
+
+
diff --git a/lib/popup/index.wxss b/lib/popup/index.wxss
new file mode 100644
index 00000000..0f7a49d8
--- /dev/null
+++ b/lib/popup/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-popup{position:fixed;top:50%;left:50%;max-height:100%;overflow-y:auto;background-color:#fff;box-sizing:border-box;-webkit-animation:ease both;animation:ease both;-webkit-overflow-scrolling:touch;transition-timing-function:ease}.van-popup--center{-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-popup--top{top:0;right:auto;bottom:auto;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--right{top:50%;right:0;bottom:auto;left:auto;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--bottom{top:auto;right:auto;bottom:0;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--left{top:50%;right:auto;bottom:auto;left:0;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--bottom.van-popup--safe{padding-bottom:34px}.van-popup--left .van-popup__safe-top,.van-popup--right .van-popup__safe-top,.van-popup--top .van-popup__safe-top{height:44px}.van-popup--bottom .van-popup__safe-top,.van-popup--center .van-popup__safe-top{padding-top:0!important}.van-scale-enter-active,.van-scale-leave-active{transition-property:opacity,-webkit-transform;transition-property:opacity,transform;transition-property:opacity,transform,-webkit-transform}.van-scale-enter,.van-scale-leave-to{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7)}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-center-enter-active,.van-center-leave-active{transition-property:opacity}.van-center-enter,.van-center-leave-to{opacity:0}.van-bottom-enter-active,.van-bottom-leave-active,.van-left-enter-active,.van-left-leave-active,.van-right-enter-active,.van-right-leave-active,.van-top-enter-active,.van-top-leave-active{transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-bottom-enter,.van-bottom-leave-to{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}.van-top-enter,.van-top-leave-to{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}.van-left-enter,.van-left-leave-to{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}.van-right-enter,.van-right-leave-to{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}
\ No newline at end of file
diff --git a/lib/progress/index.js b/lib/progress/index.js
new file mode 100644
index 00000000..e745f906
--- /dev/null
+++ b/lib/progress/index.js
@@ -0,0 +1,68 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var color_1 = require("../common/color");
+component_1.VantComponent({
+ props: {
+ inactive: Boolean,
+ percentage: Number,
+ pivotText: String,
+ pivotColor: String,
+ showPivot: {
+ type: Boolean,
+ value: true
+ },
+ color: {
+ type: String,
+ value: color_1.BLUE
+ },
+ textColor: {
+ type: String,
+ value: '#fff'
+ }
+ },
+ data: {
+ pivotWidth: 0,
+ progressWidth: 0
+ },
+ watch: {
+ pivotText: 'getWidth',
+ showPivot: 'getWidth'
+ },
+ computed: {
+ portionStyle: function () {
+ var width = (this.data.progressWidth - this.data.pivotWidth) * this.data.percentage / 100 + 'px';
+ var background = this.getCurrentColor();
+ return "width: " + width + "; background: " + background + "; ";
+ },
+ pivotStyle: function () {
+ var color = this.data.textColor;
+ var background = this.data.pivotColor || this.getCurrentColor();
+ return "color: " + color + "; background: " + background;
+ },
+ text: function () {
+ return this.data.pivotText || this.data.percentage + '%';
+ }
+ },
+ mounted: function () {
+ this.getWidth();
+ },
+ methods: {
+ getCurrentColor: function () {
+ return this.data.inactive ? '#cacaca' : this.data.color;
+ },
+ getWidth: function () {
+ var _this = this;
+ this.getRect('.van-progress').then(function (rect) {
+ _this.set({
+ progressWidth: rect.width
+ });
+ });
+ this.getRect('.van-progress__pivot').then(function (rect) {
+ _this.set({
+ pivotWidth: rect.width || 0
+ });
+ });
+ }
+ }
+});
diff --git a/lib/progress/index.json b/lib/progress/index.json
new file mode 100644
index 00000000..467ce294
--- /dev/null
+++ b/lib/progress/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/lib/progress/index.wxml b/lib/progress/index.wxml
new file mode 100644
index 00000000..d08248dc
--- /dev/null
+++ b/lib/progress/index.wxml
@@ -0,0 +1,14 @@
+
+
+
+ {{ text }}
+
+
+
diff --git a/lib/progress/index.wxss b/lib/progress/index.wxss
new file mode 100644
index 00000000..5821e13a
--- /dev/null
+++ b/lib/progress/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-progress{height:4px;position:relative;border-radius:4px;background:#e5e5e5}.van-progress__portion{left:0;height:100%;position:absolute;border-radius:inherit}.van-progress__portion--with-pivot{border-top-right-radius:0;border-bottom-right-radius:0}.van-progress__pivot{top:50%;right:0;min-width:2em;padding:0 5px;font-size:10px;position:absolute;line-height:1.6;text-align:center;border-radius:1em;word-break:keep-all;box-sizing:border-box;background-color:#e5e5e5;-webkit-transform:translate(100%,-50%);transform:translate(100%,-50%)}
\ No newline at end of file
diff --git a/lib/radio-group/index.js b/lib/radio-group/index.js
new file mode 100644
index 00000000..5a4f420e
--- /dev/null
+++ b/lib/radio-group/index.js
@@ -0,0 +1,35 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ field: true,
+ relation: {
+ name: 'radio',
+ type: 'descendant',
+ linked: function (target) {
+ var _a = this.data, value = _a.value, disabled = _a.disabled;
+ target.set({
+ value: value,
+ disabled: disabled || target.data.disabled
+ });
+ }
+ },
+ props: {
+ value: null,
+ disabled: Boolean
+ },
+ watch: {
+ value: function (value) {
+ var children = this.getRelationNodes('../radio/index');
+ children.forEach(function (child) {
+ child.set({ value: value });
+ });
+ },
+ disabled: function (disabled) {
+ var children = this.getRelationNodes('../radio/index');
+ children.forEach(function (child) {
+ child.set({ disabled: disabled || child.data.disabled });
+ });
+ }
+ }
+});
diff --git a/lib/radio-group/index.json b/lib/radio-group/index.json
new file mode 100644
index 00000000..0a336c08
--- /dev/null
+++ b/lib/radio-group/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index"
+ }
+}
diff --git a/lib/radio-group/index.wxml b/lib/radio-group/index.wxml
new file mode 100644
index 00000000..4fa864ce
--- /dev/null
+++ b/lib/radio-group/index.wxml
@@ -0,0 +1 @@
+
diff --git a/lib/radio-group/index.wxss b/lib/radio-group/index.wxss
new file mode 100644
index 00000000..99694d60
--- /dev/null
+++ b/lib/radio-group/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';
\ No newline at end of file
diff --git a/lib/radio/index.js b/lib/radio/index.js
new file mode 100644
index 00000000..61974cb0
--- /dev/null
+++ b/lib/radio/index.js
@@ -0,0 +1,34 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ field: true,
+ relation: {
+ name: 'radio-group',
+ type: 'ancestor'
+ },
+ classes: ['icon-class', 'label-class'],
+ props: {
+ name: null,
+ value: null,
+ disabled: Boolean,
+ labelDisabled: Boolean,
+ labelPosition: String,
+ checkedColor: String
+ },
+ methods: {
+ emitChange: function (value) {
+ var instance = this.getRelationNodes('../radio-group/index')[0] || this;
+ instance.$emit('input', value);
+ instance.$emit('change', value);
+ },
+ onChange: function (event) {
+ this.emitChange(event.detail.value);
+ },
+ onClickLabel: function () {
+ if (!this.data.disabled && !this.data.labelDisabled) {
+ this.emitChange(this.data.name);
+ }
+ }
+ }
+});
diff --git a/lib/radio/index.json b/lib/radio/index.json
new file mode 100644
index 00000000..0a336c08
--- /dev/null
+++ b/lib/radio/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index"
+ }
+}
diff --git a/lib/radio/index.wxml b/lib/radio/index.wxml
new file mode 100644
index 00000000..fde5f2e8
--- /dev/null
+++ b/lib/radio/index.wxml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/radio/index.wxss b/lib/radio/index.wxss
new file mode 100644
index 00000000..73038ed3
--- /dev/null
+++ b/lib/radio/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-radio{overflow:hidden;line-height:1;-webkit-user-select:none;user-select:none}.van-radio__input,.van-radio__label{display:inline-block;vertical-align:middle}.van-radio__input{position:relative;font-size:20px}.van-radio__control{z-index:1;position:absolute;top:0;left:0;width:100%;height:100%;margin:0;opacity:0}.van-radio__label{margin-left:10px;color:#333;font-size:16px;line-height:20px}.van-radio__label--left{margin:0 10px 0 0;float:left}.van-radio__label:empty{margin:0}.van-radio__icon{pointer-events:none;display:block;line-height:0}.van-radio__icon--disabled{color:#e5e5e5}.van-radio__icon--checked{color:#1989fa}.van-radio__icon--check{color:#c9c9c9}
\ No newline at end of file
diff --git a/lib/rate/index.js b/lib/rate/index.js
new file mode 100644
index 00000000..996885a6
--- /dev/null
+++ b/lib/rate/index.js
@@ -0,0 +1,96 @@
+"use strict";
+var __assign = (this && this.__assign) || function () {
+ __assign = Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ field: true,
+ classes: ['icon-class'],
+ props: {
+ readonly: Boolean,
+ disabled: Boolean,
+ size: {
+ type: Number,
+ value: 20
+ },
+ icon: {
+ type: String,
+ value: 'star'
+ },
+ voidIcon: {
+ type: String,
+ value: 'star-o'
+ },
+ color: {
+ type: String,
+ value: '#ffd21e'
+ },
+ voidColor: {
+ type: String,
+ value: '#c7c7c7'
+ },
+ disabledColor: {
+ type: String,
+ value: '#bdbdbd'
+ },
+ count: {
+ type: Number,
+ value: 5
+ },
+ value: {
+ type: Number,
+ value: 0
+ }
+ },
+ data: {
+ innerValue: 0
+ },
+ watch: {
+ value: function (value) {
+ if (value !== this.data.innerValue) {
+ this.set({ innerValue: value });
+ }
+ }
+ },
+ computed: {
+ list: function () {
+ var _a = this.data, count = _a.count, innerValue = _a.innerValue;
+ return Array.from({ length: count }, function (_, index) { return index < innerValue; });
+ }
+ },
+ methods: {
+ onSelect: function (event) {
+ var data = this.data;
+ var index = event.currentTarget.dataset.index;
+ if (!data.disabled && !data.readonly) {
+ this.set({ innerValue: index + 1 });
+ this.$emit('input', index + 1);
+ this.$emit('change', index + 1);
+ }
+ },
+ onTouchMove: function (event) {
+ var _this = this;
+ var _a = event.touches[0], clientX = _a.clientX, clientY = _a.clientY;
+ this.getRect('.van-rate__item', true).then(function (list) {
+ var target = list.find(function (item) {
+ return clientX >= item.left &&
+ clientX <= item.right &&
+ clientY >= item.top &&
+ clientY <= item.bottom;
+ });
+ if (target != null) {
+ _this.onSelect(__assign({}, event, { currentTarget: target }));
+ }
+ });
+ }
+ }
+});
diff --git a/lib/rate/index.json b/lib/rate/index.json
new file mode 100644
index 00000000..0a336c08
--- /dev/null
+++ b/lib/rate/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index"
+ }
+}
diff --git a/lib/rate/index.wxml b/lib/rate/index.wxml
new file mode 100644
index 00000000..248ac8c5
--- /dev/null
+++ b/lib/rate/index.wxml
@@ -0,0 +1,16 @@
+
+
+
diff --git a/lib/rate/index.wxss b/lib/rate/index.wxss
new file mode 100644
index 00000000..93630236
--- /dev/null
+++ b/lib/rate/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-rate{-webkit-user-select:none;user-select:none}.van-rate__item{width:1em;padding:0 2px;box-sizing:initial}
\ No newline at end of file
diff --git a/lib/row/index.js b/lib/row/index.js
new file mode 100644
index 00000000..767223e0
--- /dev/null
+++ b/lib/row/index.js
@@ -0,0 +1,39 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ relation: {
+ name: 'col',
+ type: 'descendant',
+ linked: function (target) {
+ if (this.data.gutter) {
+ target.setGutter(this.data.gutter);
+ }
+ }
+ },
+ props: {
+ gutter: Number
+ },
+ watch: {
+ gutter: 'setGutter'
+ },
+ mounted: function () {
+ if (this.data.gutter) {
+ this.setGutter();
+ }
+ },
+ methods: {
+ setGutter: function () {
+ var _this = this;
+ var gutter = this.data.gutter;
+ var margin = "-" + Number(gutter) / 2 + "px";
+ var style = gutter
+ ? "margin-right: " + margin + "; margin-left: " + margin + ";"
+ : '';
+ this.set({ style: style });
+ this.getRelationNodes('../col/index').forEach(function (col) {
+ col.setGutter(_this.data.gutter);
+ });
+ }
+ }
+});
diff --git a/lib/row/index.json b/lib/row/index.json
new file mode 100644
index 00000000..467ce294
--- /dev/null
+++ b/lib/row/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/lib/row/index.wxml b/lib/row/index.wxml
new file mode 100644
index 00000000..20c53661
--- /dev/null
+++ b/lib/row/index.wxml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/lib/row/index.wxss b/lib/row/index.wxss
new file mode 100644
index 00000000..9a46c3f9
--- /dev/null
+++ b/lib/row/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-row:after{content:"";display:table;clear:both}
\ No newline at end of file
diff --git a/lib/search/index.js b/lib/search/index.js
new file mode 100644
index 00000000..58d1aed6
--- /dev/null
+++ b/lib/search/index.js
@@ -0,0 +1,54 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ field: true,
+ classes: ['field-class', 'input-class', 'cancel-class'],
+ props: {
+ focus: Boolean,
+ error: Boolean,
+ disabled: Boolean,
+ readonly: Boolean,
+ inputAlign: String,
+ showAction: Boolean,
+ useActionSlot: Boolean,
+ placeholder: String,
+ placeholderStyle: String,
+ background: {
+ type: String,
+ value: '#ffffff'
+ },
+ maxlength: {
+ type: Number,
+ value: -1
+ },
+ shape: {
+ type: String,
+ value: 'square'
+ },
+ label: String
+ },
+ methods: {
+ onChange: function (event) {
+ this.set({ value: event.detail });
+ this.$emit('change', event.detail);
+ },
+ onCancel: function () {
+ this.set({ value: '' });
+ this.$emit('cancel');
+ this.$emit('change', '');
+ },
+ onSearch: function () {
+ this.$emit('search', this.data.value);
+ },
+ onFocus: function () {
+ this.$emit('focus');
+ },
+ onBlur: function () {
+ this.$emit('blur');
+ },
+ onClear: function () {
+ this.$emit('clear');
+ },
+ }
+});
diff --git a/lib/search/index.json b/lib/search/index.json
new file mode 100644
index 00000000..e39fb2d0
--- /dev/null
+++ b/lib/search/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index",
+ "van-field": "../field/index"
+ }
+}
diff --git a/lib/search/index.wxml b/lib/search/index.wxml
new file mode 100644
index 00000000..6f0beb00
--- /dev/null
+++ b/lib/search/index.wxml
@@ -0,0 +1,46 @@
+
+
+
+
+ {{ label }}
+
+
+
+
+
+
+
+ 取消
+
+
diff --git a/lib/search/index.wxss b/lib/search/index.wxss
new file mode 100644
index 00000000..9fe3f691
--- /dev/null
+++ b/lib/search/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-search{padding:10px 16px;-webkit-align-items:center;align-items:center;box-sizing:border-box}.van-search,.van-search__content{display:-webkit-flex;display:flex}.van-search__content{padding-left:10px;background-color:#f7f8fa;border-radius:2px;-webkit-flex:1;flex:1}.van-search__content--round{border-radius:17px}.van-search__label{padding:0 5px;font-size:14px;line-height:34px;color:#333}.van-search__field{-webkit-flex:1;flex:1}.van-search__field__left-icon{color:#999}.van-search--withaction{padding-right:0}.van-search input::-webkit-search-cancel-button,.van-search input::-webkit-search-decoration,.van-search input::-webkit-search-results-button,.van-search input::-webkit-search-results-decoration{display:none}.van-search__action{padding:0 10px;font-size:14px;line-height:34px;color:#333}.van-search__action--hover{background-color:#f2f3f5}
\ No newline at end of file
diff --git a/lib/slider/index.js b/lib/slider/index.js
new file mode 100644
index 00000000..adb6c0e6
--- /dev/null
+++ b/lib/slider/index.js
@@ -0,0 +1,90 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var touch_1 = require("../mixins/touch");
+component_1.VantComponent({
+ mixins: [touch_1.touch],
+ props: {
+ disabled: Boolean,
+ useButtonSlot: Boolean,
+ activeColor: String,
+ inactiveColor: String,
+ max: {
+ type: Number,
+ value: 100
+ },
+ min: {
+ type: Number,
+ value: 0
+ },
+ step: {
+ type: Number,
+ value: 1
+ },
+ value: {
+ type: Number,
+ value: 0
+ },
+ barHeight: {
+ type: String,
+ value: '2px'
+ }
+ },
+ watch: {
+ value: function (value) {
+ this.updateValue(value, false);
+ }
+ },
+ created: function () {
+ this.updateValue(this.data.value);
+ },
+ methods: {
+ onTouchStart: function (event) {
+ if (this.data.disabled)
+ return;
+ this.touchStart(event);
+ this.startValue = this.format(this.data.value);
+ },
+ onTouchMove: function (event) {
+ var _this = this;
+ if (this.data.disabled)
+ return;
+ this.touchMove(event);
+ this.getRect('.van-slider').then(function (rect) {
+ var diff = _this.deltaX / rect.width * 100;
+ _this.updateValue(_this.startValue + diff, false, true);
+ });
+ },
+ onTouchEnd: function () {
+ if (this.data.disabled)
+ return;
+ this.updateValue(this.data.value, true);
+ },
+ onClick: function (event) {
+ var _this = this;
+ if (this.data.disabled)
+ return;
+ this.getRect('.van-slider').then(function (rect) {
+ var value = (event.detail.x - rect.left) / rect.width * 100;
+ _this.updateValue(value, true);
+ });
+ },
+ updateValue: function (value, end, drag) {
+ value = this.format(value);
+ this.set({
+ value: value,
+ barStyle: "width: " + value + "%; height: " + this.data.barHeight + ";"
+ });
+ if (drag) {
+ this.$emit('drag', { value: value });
+ }
+ if (end) {
+ this.$emit('change', value);
+ }
+ },
+ format: function (value) {
+ var _a = this.data, max = _a.max, min = _a.min, step = _a.step;
+ return Math.round(Math.max(min, Math.min(value, max)) / step) * step;
+ }
+ }
+});
diff --git a/lib/slider/index.json b/lib/slider/index.json
new file mode 100644
index 00000000..467ce294
--- /dev/null
+++ b/lib/slider/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/lib/slider/index.wxml b/lib/slider/index.wxml
new file mode 100644
index 00000000..d30d078b
--- /dev/null
+++ b/lib/slider/index.wxml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/slider/index.wxss b/lib/slider/index.wxss
new file mode 100644
index 00000000..f227c663
--- /dev/null
+++ b/lib/slider/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-slider{position:relative;border-radius:999px;background-color:#e5e5e5}.van-slider__bar{position:relative;border-radius:inherit;background-color:#1989fa}.van-slider__button{width:20px;height:20px;border-radius:50%;background-color:#fff;box-shadow:0 1px 2px rgba(0,0,0,.5)}.van-slider__button-wrapper{position:absolute;top:50%;right:0;-webkit-transform:translate3d(50%,-50%,0);transform:translate3d(50%,-50%,0)}.van-slider__button-wrapper:after{content:"";position:absolute;width:200%;height:200%;top:-50%;left:-50%}.van-slider--disabled{opacity:.3}
\ No newline at end of file
diff --git a/lib/stepper/index.js b/lib/stepper/index.js
new file mode 100644
index 00000000..8b413160
--- /dev/null
+++ b/lib/stepper/index.js
@@ -0,0 +1,98 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ field: true,
+ classes: [
+ 'input-class',
+ 'plus-class',
+ 'minus-class'
+ ],
+ props: {
+ value: null,
+ integer: Boolean,
+ disabled: Boolean,
+ inputWidth: String,
+ asyncChange: Boolean,
+ disableInput: Boolean,
+ min: {
+ type: null,
+ value: 1
+ },
+ max: {
+ type: null,
+ value: Number.MAX_SAFE_INTEGER
+ },
+ step: {
+ type: null,
+ value: 1
+ }
+ },
+ computed: {
+ minusDisabled: function () {
+ return this.data.disabled || this.data.value <= this.data.min;
+ },
+ plusDisabled: function () {
+ return this.data.disabled || this.data.value >= this.data.max;
+ }
+ },
+ watch: {
+ value: function (value) {
+ if (value === '') {
+ return;
+ }
+ var newValue = this.range(value);
+ if (typeof newValue === 'number' && value !== newValue) {
+ this.set({ value: newValue });
+ }
+ }
+ },
+ data: {
+ focus: false
+ },
+ created: function () {
+ this.set({
+ value: this.range(this.data.value)
+ });
+ },
+ methods: {
+ onFocus: function (event) {
+ this.$emit('focus', event.detail);
+ },
+ onBlur: function (event) {
+ var value = this.range(this.data.value);
+ this.triggerInput(value);
+ this.$emit('blur', event.detail);
+ },
+ // limit value range
+ range: function (value) {
+ return Math.max(Math.min(this.data.max, value), this.data.min);
+ },
+ onInput: function (event) {
+ var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a;
+ this.triggerInput(value);
+ },
+ onChange: function (type) {
+ if (this.data[type + "Disabled"]) {
+ this.$emit('overlimit', type);
+ return;
+ }
+ var diff = type === 'minus' ? -this.data.step : +this.data.step;
+ var value = Math.round((this.data.value + diff) * 100) / 100;
+ this.triggerInput(this.range(value));
+ this.$emit(type);
+ },
+ onMinus: function () {
+ this.onChange('minus');
+ },
+ onPlus: function () {
+ this.onChange('plus');
+ },
+ triggerInput: function (value) {
+ this.set({
+ value: this.data.asyncChange ? this.data.value : value
+ });
+ this.$emit('change', value);
+ }
+ }
+});
diff --git a/lib/stepper/index.json b/lib/stepper/index.json
new file mode 100644
index 00000000..32640e0d
--- /dev/null
+++ b/lib/stepper/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
\ No newline at end of file
diff --git a/lib/stepper/index.wxml b/lib/stepper/index.wxml
new file mode 100644
index 00000000..7d16f4d9
--- /dev/null
+++ b/lib/stepper/index.wxml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
diff --git a/lib/stepper/index.wxss b/lib/stepper/index.wxss
new file mode 100644
index 00000000..e681a77d
--- /dev/null
+++ b/lib/stepper/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-stepper{font-size:0}.van-stepper__minus,.van-stepper__plus{position:relative;display:inline-block;width:28px;height:28px;padding:5px;margin:1px;vertical-align:middle;background-color:#f2f3f5;border:0;box-sizing:border-box}.van-stepper__minus:before,.van-stepper__plus:before{width:9px;height:1px}.van-stepper__minus:after,.van-stepper__plus:after{width:1px;height:9px}.van-stepper__minus:after,.van-stepper__minus:before,.van-stepper__plus:after,.van-stepper__plus:before{position:absolute;top:0;right:0;bottom:0;left:0;margin:auto;background-color:#333;content:""}.van-stepper__minus--hover,.van-stepper__plus--hover{background-color:#e8e8e8}.van-stepper__minus--disabled,.van-stepper__plus--disabled{background-color:#f7f8fa}.van-stepper__minus--disabled:after,.van-stepper__minus--disabled:before,.van-stepper__plus--disabled:after,.van-stepper__plus--disabled:before{background-color:#c9c9c9}.van-stepper__minus--disabled.van-stepper__minus--hover,.van-stepper__minus--disabled.van-stepper__plus--hover,.van-stepper__plus--disabled.van-stepper__minus--hover,.van-stepper__plus--disabled.van-stepper__plus--hover{background-color:#f7f8fa}.van-stepper__minus{border-radius:4px 0 0 4px}.van-stepper__minus:after{display:none}.van-stepper__plus{border-radius:0 4px 4px 0}.van-stepper__input{display:inline-block;width:30px;height:26px;padding:1px;margin:1px;font-size:14px;color:#333;text-align:center;vertical-align:middle;background-color:#f2f3f5;border:0;border-width:1px 0;border-radius:0;box-sizing:initial;-webkit-appearance:none}.van-stepper__input--disabled{color:#c9c9c9;background-color:#f2f3f5}
\ No newline at end of file
diff --git a/lib/steps/index.js b/lib/steps/index.js
new file mode 100644
index 00000000..10e74114
--- /dev/null
+++ b/lib/steps/index.js
@@ -0,0 +1,19 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var color_1 = require("../common/color");
+component_1.VantComponent({
+ props: {
+ icon: String,
+ steps: Array,
+ active: Number,
+ direction: {
+ type: String,
+ value: 'horizontal'
+ },
+ activeColor: {
+ type: String,
+ value: color_1.GREEN
+ }
+ }
+});
diff --git a/lib/steps/index.json b/lib/steps/index.json
new file mode 100644
index 00000000..0a336c08
--- /dev/null
+++ b/lib/steps/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index"
+ }
+}
diff --git a/lib/steps/index.wxml b/lib/steps/index.wxml
new file mode 100644
index 00000000..508705d6
--- /dev/null
+++ b/lib/steps/index.wxml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+ {{ item.text }}
+ {{ item.desc }}
+
+
+
+
+
+
+
+
+
+
+
+function get(index, active) {
+ if (index < active) {
+ return 'finish';
+ } else if (index === active) {
+ return 'process';
+ }
+
+ return '';
+}
+
+module.exports = get;
+
diff --git a/lib/steps/index.wxss b/lib/steps/index.wxss
new file mode 100644
index 00000000..8ffab006
--- /dev/null
+++ b/lib/steps/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-steps{overflow:hidden;background-color:#fff}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{position:relative;display:-webkit-flex;display:flex;overflow:hidden}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{position:relative;-webkit-flex:1;flex:1;font-size:14px;color:#999}.van-step--finish{color:#333}.van-step__circle{width:5px;height:5px;background-color:#999;border-radius:50%}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{-webkit-transform:none;transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 0;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.van-step--horizontal:last-child{position:absolute;right:0;width:auto}.van-step--horizontal:last-child .van-step__title{text-align:right;-webkit-transform:none;transform:none}.van-step--horizontal:last-child .van-step__circle-container{right:0;padding:0 0 0 8px;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{position:absolute;bottom:6px;z-index:1;padding:0 8px;background-color:#fff;-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.van-step--horizontal .van-step__title{display:inline-block;font-size:12px;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{position:absolute;right:0;bottom:6px;left:0;height:1px;background-color:#eee;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:#333}.van-step--horizontal.van-step--process .van-step__active{display:block;font-size:12px;line-height:1}.van-step--vertical{padding:10px 10px 10px 0;font-size:14px;line-height:18px}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{position:absolute;top:0;left:-15px;z-index:1;width:1px;height:20px;background-color:#fff;content:""}.van-step--vertical .van-step__active,.van-step--vertical .van-step__circle,.van-step--vertical .van-step__line{position:absolute;top:19px;left:-14px;z-index:2;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-step--vertical .van-step__active{font-size:12px;line-height:1}.van-step--vertical .van-step__line{z-index:1;width:1px;height:100%;background-color:#eee;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}
\ No newline at end of file
diff --git a/lib/submit-bar/index.js b/lib/submit-bar/index.js
new file mode 100644
index 00000000..981955a6
--- /dev/null
+++ b/lib/submit-bar/index.js
@@ -0,0 +1,46 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var safe_area_1 = require("../mixins/safe-area");
+component_1.VantComponent({
+ mixins: [safe_area_1.safeArea()],
+ classes: [
+ 'bar-class',
+ 'price-class',
+ 'button-class'
+ ],
+ props: {
+ tip: null,
+ type: Number,
+ price: null,
+ label: String,
+ loading: Boolean,
+ disabled: Boolean,
+ buttonText: String,
+ currency: {
+ type: String,
+ value: '¥'
+ },
+ buttonType: {
+ type: String,
+ value: 'danger'
+ }
+ },
+ computed: {
+ hasPrice: function () {
+ return typeof this.data.price === 'number';
+ },
+ priceStr: function () {
+ return (this.data.price / 100).toFixed(2);
+ },
+ tipStr: function () {
+ var tip = this.data.tip;
+ return typeof tip === 'string' ? tip : '';
+ }
+ },
+ methods: {
+ onSubmit: function (event) {
+ this.$emit('submit', event.detail);
+ }
+ }
+});
diff --git a/lib/submit-bar/index.json b/lib/submit-bar/index.json
new file mode 100644
index 00000000..b5676868
--- /dev/null
+++ b/lib/submit-bar/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-button": "../button/index"
+ }
+}
diff --git a/lib/submit-bar/index.wxml b/lib/submit-bar/index.wxml
new file mode 100644
index 00000000..42fc9516
--- /dev/null
+++ b/lib/submit-bar/index.wxml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+ {{ tipStr }}
+
+
+
+
+
+
+ {{ label || '合计:' }}
+
+ {{ currency }} {{ priceStr }}
+
+
+
+
+ {{ loading ? '' : buttonText }}
+
+
+
diff --git a/lib/submit-bar/index.wxss b/lib/submit-bar/index.wxss
new file mode 100644
index 00000000..a8e83b49
--- /dev/null
+++ b/lib/submit-bar/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-submit-bar{z-index:100;position:fixed;bottom:0;left:0;width:100%;-webkit-user-select:none;user-select:none}.van-submit-bar__tip{padding:10px;color:#f56723;font-size:12px;line-height:18px;background-color:#fff7cc}.van-submit-bar__bar{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:50px;background-color:#fff;font-size:14px}.van-submit-bar__bar--safe{padding-bottom:34px}.van-submit-bar__text{-webkit-flex:1;flex:1;color:#333;font-weight:500;text-align:right}.van-submit-bar__price{color:#f44;font-size:18px;padding-right:12px}.van-submit-bar__currency{font-size:14px}.van-submit-bar__button button{width:110px}
\ No newline at end of file
diff --git a/lib/swipe-cell/index.js b/lib/swipe-cell/index.js
new file mode 100644
index 00000000..806bc0f4
--- /dev/null
+++ b/lib/swipe-cell/index.js
@@ -0,0 +1,118 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var touch_1 = require("../mixins/touch");
+var THRESHOLD = 0.15;
+component_1.VantComponent({
+ props: {
+ disabled: Boolean,
+ leftWidth: {
+ type: Number,
+ value: 0
+ },
+ rightWidth: {
+ type: Number,
+ value: 0
+ },
+ asyncClose: Boolean
+ },
+ mixins: [touch_1.touch],
+ data: {
+ offset: 0,
+ draging: false
+ },
+ computed: {
+ wrapperStyle: function () {
+ var _a = this.data, offset = _a.offset, draging = _a.draging;
+ var transform = "translate3d(" + offset + "px, 0, 0)";
+ var transition = draging ? 'none' : '.6s cubic-bezier(0.18, 0.89, 0.32, 1)';
+ return "\n -webkit-transform: " + transform + ";\n -webkit-transition: " + transition + ";\n transform: " + transform + ";\n transition: " + transition + ";\n ";
+ }
+ },
+ methods: {
+ onTransitionend: function () {
+ this.swipe = false;
+ },
+ open: function (position) {
+ var _a = this.data, leftWidth = _a.leftWidth, rightWidth = _a.rightWidth;
+ var offset = position === 'left' ? leftWidth : -rightWidth;
+ this.swipeMove(offset);
+ this.resetSwipeStatus();
+ },
+ close: function () {
+ this.set({ offset: 0 });
+ },
+ resetSwipeStatus: function () {
+ this.swiping = false;
+ this.opened = true;
+ },
+ swipeMove: function (offset) {
+ if (offset === void 0) { offset = 0; }
+ this.set({ offset: offset });
+ offset && (this.swiping = true);
+ !offset && (this.opened = false);
+ },
+ swipeLeaveTransition: function (direction) {
+ var _a = this.data, offset = _a.offset, leftWidth = _a.leftWidth, rightWidth = _a.rightWidth;
+ var threshold = this.opened ? 1 - THRESHOLD : THRESHOLD;
+ // right
+ if (direction > 0 && -offset > rightWidth * threshold && rightWidth > 0) {
+ this.open('right');
+ // left
+ }
+ else if (direction < 0 && offset > leftWidth * threshold && leftWidth > 0) {
+ this.open('left');
+ }
+ else {
+ this.swipeMove();
+ }
+ },
+ startDrag: function (event) {
+ if (this.data.disabled) {
+ return;
+ }
+ this.set({ draging: true });
+ this.touchStart(event);
+ if (this.opened) {
+ this.startX -= this.data.offset;
+ }
+ },
+ onDrag: function (event) {
+ if (this.data.disabled) {
+ return;
+ }
+ this.touchMove(event);
+ var deltaX = this.deltaX;
+ var _a = this.data, leftWidth = _a.leftWidth, rightWidth = _a.rightWidth;
+ if ((deltaX < 0 && (-deltaX > rightWidth || !rightWidth)) ||
+ (deltaX > 0 && (deltaX > leftWidth || (deltaX > 0 && !leftWidth)))) {
+ return;
+ }
+ if (this.direction === 'horizontal') {
+ this.swipeMove(deltaX);
+ }
+ },
+ endDrag: function () {
+ if (this.data.disabled) {
+ return;
+ }
+ this.set({ draging: false });
+ if (this.swiping) {
+ this.swipeLeaveTransition(this.data.offset > 0 ? -1 : 1);
+ }
+ },
+ onClick: function (event) {
+ var _a = event.currentTarget.dataset.key, position = _a === void 0 ? 'outside' : _a;
+ this.$emit('click', position);
+ if (!this.data.offset) {
+ return;
+ }
+ if (this.data.asyncClose) {
+ this.$emit('close', { position: position, instance: this });
+ }
+ else {
+ this.swipeMove(0);
+ }
+ }
+ }
+});
diff --git a/lib/swipe-cell/index.json b/lib/swipe-cell/index.json
new file mode 100644
index 00000000..467ce294
--- /dev/null
+++ b/lib/swipe-cell/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/lib/swipe-cell/index.wxml b/lib/swipe-cell/index.wxml
new file mode 100644
index 00000000..35bfef93
--- /dev/null
+++ b/lib/swipe-cell/index.wxml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/swipe-cell/index.wxss b/lib/swipe-cell/index.wxss
new file mode 100644
index 00000000..d6152709
--- /dev/null
+++ b/lib/swipe-cell/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-swipe-cell{position:relative;overflow:hidden}.van-swipe-cell__left,.van-swipe-cell__right{position:absolute;top:0;height:100%}.van-swipe-cell__left{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.van-swipe-cell__right{right:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}
\ No newline at end of file
diff --git a/lib/switch-cell/index.js b/lib/switch-cell/index.js
new file mode 100644
index 00000000..5841c843
--- /dev/null
+++ b/lib/switch-cell/index.js
@@ -0,0 +1,41 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ field: true,
+ props: {
+ value: null,
+ title: String,
+ border: Boolean,
+ checked: Boolean,
+ loading: Boolean,
+ disabled: Boolean,
+ activeColor: String,
+ inactiveColor: String,
+ size: {
+ type: String,
+ value: '24px'
+ },
+ activeValue: {
+ type: null,
+ value: true
+ },
+ inactiveValue: {
+ type: null,
+ value: false
+ }
+ },
+ watch: {
+ checked: function (value) {
+ this.set({ value: value });
+ }
+ },
+ created: function () {
+ this.set({ value: this.data.checked });
+ },
+ methods: {
+ onChange: function (event) {
+ this.$emit('change', event.detail);
+ }
+ }
+});
diff --git a/lib/switch-cell/index.json b/lib/switch-cell/index.json
new file mode 100644
index 00000000..22e53428
--- /dev/null
+++ b/lib/switch-cell/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-cell": "../cell/index",
+ "van-switch": "../switch/index"
+ }
+}
diff --git a/lib/switch-cell/index.wxml b/lib/switch-cell/index.wxml
new file mode 100644
index 00000000..2fbd686c
--- /dev/null
+++ b/lib/switch-cell/index.wxml
@@ -0,0 +1,19 @@
+
+
+
diff --git a/lib/switch-cell/index.wxss b/lib/switch-cell/index.wxss
new file mode 100644
index 00000000..2ad612ee
--- /dev/null
+++ b/lib/switch-cell/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-switch-cell{padding-top:9px;padding-bottom:9px}.van-switch-cell__switch{vertical-align:middle}
\ No newline at end of file
diff --git a/lib/switch/index.js b/lib/switch/index.js
new file mode 100644
index 00000000..67a8abd5
--- /dev/null
+++ b/lib/switch/index.js
@@ -0,0 +1,45 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ field: true,
+ classes: ['node-class'],
+ props: {
+ checked: null,
+ loading: Boolean,
+ disabled: Boolean,
+ activeColor: String,
+ inactiveColor: String,
+ size: {
+ type: String,
+ value: '30px'
+ },
+ activeValue: {
+ type: null,
+ value: true
+ },
+ inactiveValue: {
+ type: null,
+ value: false
+ }
+ },
+ watch: {
+ checked: function (value) {
+ this.set({ value: value });
+ }
+ },
+ created: function () {
+ this.set({ value: this.data.checked });
+ },
+ methods: {
+ onClick: function () {
+ var _a = this.data, activeValue = _a.activeValue, inactiveValue = _a.inactiveValue;
+ if (!this.data.disabled && !this.data.loading) {
+ var checked = this.data.checked === activeValue;
+ var value = checked ? inactiveValue : activeValue;
+ this.$emit('input', value);
+ this.$emit('change', value);
+ }
+ }
+ }
+});
diff --git a/lib/switch/index.json b/lib/switch/index.json
new file mode 100644
index 00000000..01077f5d
--- /dev/null
+++ b/lib/switch/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-loading": "../loading/index"
+ }
+}
diff --git a/lib/switch/index.wxml b/lib/switch/index.wxml
new file mode 100644
index 00000000..74ce520e
--- /dev/null
+++ b/lib/switch/index.wxml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/lib/switch/index.wxss b/lib/switch/index.wxss
new file mode 100644
index 00000000..85cadf3d
--- /dev/null
+++ b/lib/switch/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-switch{display:inline-block;position:relative;width:2em;border:1px solid rgba(0,0,0,.1);border-radius:1em;box-sizing:initial;transition:background-color .3s}.van-switch,.van-switch__node{height:1em;background-color:#fff}.van-switch__node{top:0;left:0;position:absolute;border-radius:100%;width:1em;z-index:1;transition:.3s;box-shadow:0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05)}.van-switch__loading{top:25%;left:25%;position:absolute!important}.van-switch--on{background-color:#1989fa}.van-switch--on .van-switch__node{-webkit-transform:translateX(1em);transform:translateX(1em)}.van-switch--disabled{opacity:.4}
\ No newline at end of file
diff --git a/lib/tab/index.js b/lib/tab/index.js
new file mode 100644
index 00000000..92b523f6
--- /dev/null
+++ b/lib/tab/index.js
@@ -0,0 +1,37 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ relation: {
+ name: 'tabs',
+ type: 'ancestor'
+ },
+ props: {
+ dot: Boolean,
+ info: null,
+ title: String,
+ disabled: Boolean,
+ titleStyle: String
+ },
+ data: {
+ width: null,
+ inited: false,
+ active: false,
+ animated: false
+ },
+ watch: {
+ title: 'update',
+ disabled: 'update',
+ dot: 'update',
+ info: 'update',
+ titleStyle: 'update'
+ },
+ methods: {
+ update: function () {
+ var parent = this.getRelationNodes('../tabs/index')[0];
+ if (parent) {
+ parent.updateTabs();
+ }
+ }
+ }
+});
diff --git a/lib/tab/index.json b/lib/tab/index.json
new file mode 100644
index 00000000..32640e0d
--- /dev/null
+++ b/lib/tab/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
\ No newline at end of file
diff --git a/lib/tab/index.wxml b/lib/tab/index.wxml
new file mode 100644
index 00000000..b90f452a
--- /dev/null
+++ b/lib/tab/index.wxml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/lib/tab/index.wxss b/lib/tab/index.wxss
new file mode 100644
index 00000000..e2e67a98
--- /dev/null
+++ b/lib/tab/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-tab__pane{box-sizing:border-box;overflow-y:auto}.van-tab__pane--active{height:auto}.van-tab__pane--inactive{height:0;overflow:visible}
\ No newline at end of file
diff --git a/lib/tabbar-item/index.js b/lib/tabbar-item/index.js
new file mode 100644
index 00000000..218adb09
--- /dev/null
+++ b/lib/tabbar-item/index.js
@@ -0,0 +1,35 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ props: {
+ info: null,
+ icon: String,
+ dot: Boolean
+ },
+ relation: {
+ name: 'tabbar',
+ type: 'ancestor',
+ linked: function (target) {
+ this.parent = target;
+ }
+ },
+ data: {
+ active: false
+ },
+ methods: {
+ onClick: function () {
+ if (this.parent) {
+ this.parent.onChange(this);
+ }
+ this.$emit('click');
+ },
+ setActive: function (_a) {
+ var active = _a.active, color = _a.color;
+ if (this.data.active !== active) {
+ return this.set({ active: active, color: color });
+ }
+ return Promise.resolve();
+ }
+ }
+});
diff --git a/lib/tabbar-item/index.json b/lib/tabbar-item/index.json
new file mode 100644
index 00000000..16f174c5
--- /dev/null
+++ b/lib/tabbar-item/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index",
+ "van-info": "../info/index"
+ }
+}
diff --git a/lib/tabbar-item/index.wxml b/lib/tabbar-item/index.wxml
new file mode 100644
index 00000000..58940604
--- /dev/null
+++ b/lib/tabbar-item/index.wxml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/tabbar-item/index.wxss b/lib/tabbar-item/index.wxss
new file mode 100644
index 00000000..d2c9d16e
--- /dev/null
+++ b/lib/tabbar-item/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-tabbar-item{color:#7d7e80;height:100%;display:-webkit-flex;display:flex;line-height:1;font-size:12px;-webkit-align-items:center;align-items:center;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center}.van-tabbar-item__icon{font-size:18px;margin-bottom:5px;position:relative}.van-tabbar-item__icon--dot:after{top:0;right:-8px;width:8px;height:8px;content:" ";position:absolute;border-radius:100%;background-color:#f44}.van-tabbar-item__icon image{width:30px;height:18px;display:block}.van-tabbar-item--active{color:#1989fa}
\ No newline at end of file
diff --git a/lib/tabbar/index.js b/lib/tabbar/index.js
new file mode 100644
index 00000000..e0b86631
--- /dev/null
+++ b/lib/tabbar/index.js
@@ -0,0 +1,66 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var safe_area_1 = require("../mixins/safe-area");
+component_1.VantComponent({
+ mixins: [safe_area_1.safeArea()],
+ relation: {
+ name: 'tabbar-item',
+ type: 'descendant',
+ linked: function (target) {
+ this.children = this.children || [];
+ this.children.push(target);
+ this.setActiveItem();
+ },
+ unlinked: function (target) {
+ this.children = this.children || [];
+ this.children = this.children.filter(function (item) { return item !== target; });
+ this.setActiveItem();
+ }
+ },
+ props: {
+ active: Number,
+ activeColor: String,
+ fixed: {
+ type: Boolean,
+ value: true
+ },
+ zIndex: {
+ type: Number,
+ value: 1
+ }
+ },
+ watch: {
+ active: function (active) {
+ this.currentActive = active;
+ this.setActiveItem();
+ }
+ },
+ created: function () {
+ this.currentActive = this.data.active;
+ },
+ methods: {
+ setActiveItem: function () {
+ var _this = this;
+ if (!Array.isArray(this.children) || !this.children.length) {
+ return Promise.resolve();
+ }
+ return Promise.all(this.children.map(function (item, index) {
+ return item.setActive({
+ active: index === _this.currentActive,
+ color: _this.data.activeColor
+ });
+ }));
+ },
+ onChange: function (child) {
+ var _this = this;
+ var active = (this.children || []).indexOf(child);
+ if (active !== this.currentActive && active !== -1) {
+ this.currentActive = active;
+ this.setActiveItem().then(function () {
+ _this.$emit('change', active);
+ });
+ }
+ }
+ }
+});
diff --git a/lib/tabbar/index.json b/lib/tabbar/index.json
new file mode 100644
index 00000000..467ce294
--- /dev/null
+++ b/lib/tabbar/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/lib/tabbar/index.wxml b/lib/tabbar/index.wxml
new file mode 100644
index 00000000..f05228e2
--- /dev/null
+++ b/lib/tabbar/index.wxml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/lib/tabbar/index.wxss b/lib/tabbar/index.wxss
new file mode 100644
index 00000000..b07814c2
--- /dev/null
+++ b/lib/tabbar/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-tabbar{display:-webkit-flex;display:flex;width:100%;height:50px;background-color:#fff}.van-tabbar--fixed{position:fixed;bottom:0;left:0}.van-tabbar--safe{padding-bottom:34px}
\ No newline at end of file
diff --git a/lib/tabs/index.js b/lib/tabs/index.js
new file mode 100644
index 00000000..7ea9b09d
--- /dev/null
+++ b/lib/tabs/index.js
@@ -0,0 +1,303 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var touch_1 = require("../mixins/touch");
+component_1.VantComponent({
+ mixins: [touch_1.touch],
+ classes: ['nav-class', 'tab-class', 'tab-active-class', 'line-class'],
+ relation: {
+ name: 'tab',
+ type: 'descendant',
+ linked: function (child) {
+ this.child.push(child);
+ this.updateTabs(this.data.tabs.concat(child.data));
+ },
+ unlinked: function (child) {
+ var index = this.child.indexOf(child);
+ var tabs = this.data.tabs;
+ tabs.splice(index, 1);
+ this.child.splice(index, 1);
+ this.updateTabs(tabs);
+ }
+ },
+ props: {
+ color: String,
+ sticky: Boolean,
+ animated: Boolean,
+ swipeable: Boolean,
+ lineWidth: {
+ type: Number,
+ value: -1
+ },
+ lineHeight: {
+ type: Number,
+ value: -1
+ },
+ active: {
+ type: Number,
+ value: 0
+ },
+ type: {
+ type: String,
+ value: 'line'
+ },
+ border: {
+ type: Boolean,
+ value: true
+ },
+ duration: {
+ type: Number,
+ value: 0.3
+ },
+ zIndex: {
+ type: Number,
+ value: 1
+ },
+ swipeThreshold: {
+ type: Number,
+ value: 4
+ },
+ offsetTop: {
+ type: Number,
+ value: 0
+ }
+ },
+ data: {
+ tabs: [],
+ lineStyle: '',
+ scrollLeft: 0,
+ scrollable: false,
+ trackStyle: '',
+ wrapStyle: '',
+ position: ''
+ },
+ watch: {
+ swipeThreshold: function () {
+ this.set({
+ scrollable: this.child.length > this.data.swipeThreshold
+ });
+ },
+ color: 'setLine',
+ lineWidth: 'setLine',
+ lineHeight: 'setLine',
+ active: 'setActiveTab',
+ animated: 'setTrack',
+ offsetTop: 'setWrapStyle'
+ },
+ beforeCreate: function () {
+ this.child = [];
+ },
+ mounted: function () {
+ var _this = this;
+ this.setLine(true);
+ this.setTrack();
+ this.scrollIntoView();
+ this.getRect('.van-tabs__wrap').then(function (rect) {
+ _this.navHeight = rect.height;
+ _this.observerContentScroll();
+ });
+ },
+ destroyed: function () {
+ this.createIntersectionObserver().disconnect();
+ },
+ methods: {
+ updateTabs: function (tabs) {
+ tabs = tabs || this.data.tabs;
+ this.set({
+ tabs: tabs,
+ scrollable: tabs.length > this.data.swipeThreshold
+ });
+ this.setActiveTab();
+ },
+ trigger: function (eventName, index) {
+ this.$emit(eventName, {
+ index: index,
+ title: this.data.tabs[index].title
+ });
+ },
+ onTap: function (event) {
+ var index = event.currentTarget.dataset.index;
+ if (this.data.tabs[index].disabled) {
+ this.trigger('disabled', index);
+ }
+ else {
+ this.trigger('click', index);
+ this.setActive(index);
+ }
+ },
+ setActive: function (active) {
+ if (active !== this.data.active) {
+ this.trigger('change', active);
+ this.set({ active: active });
+ this.setActiveTab();
+ }
+ },
+ setLine: function (skipTransition) {
+ var _this = this;
+ if (this.data.type !== 'line') {
+ return;
+ }
+ var _a = this.data, color = _a.color, active = _a.active, duration = _a.duration, lineWidth = _a.lineWidth, lineHeight = _a.lineHeight;
+ this.getRect('.van-tab', true).then(function (rects) {
+ var rect = rects[active];
+ var width = lineWidth !== -1 ? lineWidth : rect.width / 2;
+ var height = lineHeight !== -1 ? "height: " + lineHeight + "px;" : '';
+ var left = rects
+ .slice(0, active)
+ .reduce(function (prev, curr) { return prev + curr.width; }, 0);
+ left += (rect.width - width) / 2;
+ var transition = skipTransition
+ ? ''
+ : "transition-duration: " + duration + "s; -webkit-transition-duration: " + duration + "s;";
+ _this.set({
+ lineStyle: "\n " + height + "\n width: " + width + "px;\n background-color: " + color + ";\n -webkit-transform: translateX(" + left + "px);\n transform: translateX(" + left + "px);\n " + transition + "\n "
+ });
+ });
+ },
+ setTrack: function () {
+ var _this = this;
+ var _a = this.data, animated = _a.animated, active = _a.active, duration = _a.duration;
+ if (!animated)
+ return '';
+ this.getRect('.van-tabs__content').then(function (rect) {
+ var width = rect.width;
+ _this.set({
+ trackStyle: "\n width: " + width * _this.child.length + "px;\n left: " + -1 * active * width + "px;\n transition: left " + duration + "s;\n display: -webkit-box;\n display: flex;\n "
+ });
+ var props = { width: width, animated: animated };
+ _this.child.forEach(function (item) {
+ item.set(props);
+ });
+ });
+ },
+ setActiveTab: function () {
+ var _this = this;
+ this.child.forEach(function (item, index) {
+ var data = {
+ active: index === _this.data.active
+ };
+ if (data.active) {
+ data.inited = true;
+ }
+ if (data.active !== item.data.active) {
+ item.set(data);
+ }
+ });
+ this.set({}, function () {
+ _this.setLine();
+ _this.setTrack();
+ _this.scrollIntoView();
+ });
+ },
+ // scroll active tab into view
+ scrollIntoView: function () {
+ var _this = this;
+ var _a = this.data, active = _a.active, scrollable = _a.scrollable;
+ if (!scrollable) {
+ return;
+ }
+ Promise.all([
+ this.getRect('.van-tab', true),
+ this.getRect('.van-tabs__nav')
+ ]).then(function (_a) {
+ var tabRects = _a[0], navRect = _a[1];
+ var tabRect = tabRects[active];
+ var offsetLeft = tabRects
+ .slice(0, active)
+ .reduce(function (prev, curr) { return prev + curr.width; }, 0);
+ _this.set({
+ scrollLeft: offsetLeft - (navRect.width - tabRect.width) / 2
+ });
+ });
+ },
+ onTouchStart: function (event) {
+ if (!this.data.swipeable)
+ return;
+ this.touchStart(event);
+ },
+ onTouchMove: function (event) {
+ if (!this.data.swipeable)
+ return;
+ this.touchMove(event);
+ },
+ // watch swipe touch end
+ onTouchEnd: function () {
+ if (!this.data.swipeable)
+ return;
+ var _a = this.data, active = _a.active, tabs = _a.tabs;
+ var _b = this, direction = _b.direction, deltaX = _b.deltaX, offsetX = _b.offsetX;
+ var minSwipeDistance = 50;
+ if (direction === 'horizontal' && offsetX >= minSwipeDistance) {
+ if (deltaX > 0 && active !== 0) {
+ this.setActive(active - 1);
+ }
+ else if (deltaX < 0 && active !== tabs.length - 1) {
+ this.setActive(active + 1);
+ }
+ }
+ },
+ setWrapStyle: function () {
+ var _a = this.data, offsetTop = _a.offsetTop, position = _a.position;
+ var wrapStyle;
+ switch (position) {
+ case 'top':
+ wrapStyle = "\n top: " + offsetTop + "px;\n position: fixed;\n ";
+ break;
+ case 'bottom':
+ wrapStyle = "\n top: auto;\n bottom: 0;\n ";
+ break;
+ default:
+ wrapStyle = '';
+ }
+ // cut down `set`
+ if (wrapStyle === this.data.wrapStyle)
+ return;
+ this.set({ wrapStyle: wrapStyle });
+ },
+ observerContentScroll: function () {
+ var _this = this;
+ if (!this.data.sticky) {
+ return;
+ }
+ var offsetTop = this.data.offsetTop;
+ var windowHeight = wx.getSystemInfoSync().windowHeight;
+ this.createIntersectionObserver().disconnect();
+ this.createIntersectionObserver()
+ .relativeToViewport({ top: -(this.navHeight + offsetTop) })
+ .observe('.van-tabs', function (res) {
+ var top = res.boundingClientRect.top;
+ if (top > offsetTop) {
+ return;
+ }
+ var position = res.intersectionRatio > 0 ? 'top' : 'bottom';
+ _this.$emit('scroll', {
+ scrollTop: top + offsetTop,
+ isFixed: position === 'top'
+ });
+ _this.setPosition(position);
+ });
+ this.createIntersectionObserver()
+ .relativeToViewport({ bottom: -(windowHeight - 1 - offsetTop) })
+ .observe('.van-tabs', function (res) {
+ var _a = res.boundingClientRect, top = _a.top, bottom = _a.bottom;
+ if (bottom < _this.navHeight) {
+ return;
+ }
+ var position = res.intersectionRatio > 0 ? 'top' : '';
+ _this.$emit('scroll', {
+ scrollTop: top + offsetTop,
+ isFixed: position === 'top'
+ });
+ _this.setPosition(position);
+ });
+ },
+ setPosition: function (position) {
+ var _this = this;
+ if (position !== this.data.position) {
+ this.set({ position: position }).then(function () {
+ _this.setWrapStyle();
+ });
+ }
+ }
+ }
+});
diff --git a/lib/tabs/index.json b/lib/tabs/index.json
new file mode 100644
index 00000000..bf0ebe00
--- /dev/null
+++ b/lib/tabs/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-info": "../info/index"
+ }
+}
diff --git a/lib/tabs/index.wxml b/lib/tabs/index.wxml
new file mode 100644
index 00000000..1618d641
--- /dev/null
+++ b/lib/tabs/index.wxml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/tabs/index.wxss b/lib/tabs/index.wxss
new file mode 100644
index 00000000..5944afb0
--- /dev/null
+++ b/lib/tabs/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{position:absolute;top:0;right:0;left:0;display:-webkit-flex;display:flex;background-color:#fff}.van-tabs__wrap--page-top{position:fixed}.van-tabs__wrap--content-bottom{top:auto;bottom:0}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__scroll--card{border:1px solid #f44;border-radius:2px}.van-tabs__nav{position:relative;display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none}.van-tabs__nav--line{height:100%}.van-tabs__nav--card{height:30px}.van-tabs__nav--card .van-tab{line-height:30px;color:#f44;border-right:1px solid #f44}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;background-color:#f44}.van-tabs__line{position:absolute;bottom:0;left:0;z-index:1;height:3px;background-color:#f44;border-radius:3px}.van-tabs--line{padding-top:44px}.van-tabs--line .van-tabs__wrap{height:44px}.van-tabs--card{padding-top:30px;margin:0 15px}.van-tabs--card .van-tabs__wrap{height:30px}.van-tabs__content{overflow:hidden}.van-tab,.van-tabs__track{position:relative}.van-tab{min-width:0;padding:0 5px;font-size:14px;line-height:44px;color:#7d7e80;text-align:center;cursor:pointer;box-sizing:border-box;-webkit-flex:1;flex:1}.van-tab--active{font-weight:500;color:#333}.van-tab--disabled{color:#c9c9c9}.van-tab__title--dot:after{display:inline-block;width:8px;height:8px;vertical-align:middle;background-color:#f44;border-radius:100%;content:""}.van-tab__title__info{position:relative!important;top:-1px!important;display:inline-block;-webkit-transform:translateX(0)!important;transform:translateX(0)!important}
\ No newline at end of file
diff --git a/lib/tag/index.js b/lib/tag/index.js
new file mode 100644
index 00000000..e6af2a58
--- /dev/null
+++ b/lib/tag/index.js
@@ -0,0 +1,33 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var color_1 = require("../common/color");
+var DEFAULT_COLOR = '#999';
+var COLOR_MAP = {
+ danger: color_1.RED,
+ primary: color_1.BLUE,
+ success: color_1.GREEN
+};
+component_1.VantComponent({
+ props: {
+ size: String,
+ type: String,
+ mark: Boolean,
+ color: String,
+ plain: Boolean,
+ round: Boolean,
+ textColor: String
+ },
+ computed: {
+ style: function () {
+ var _a;
+ var color = this.data.color || COLOR_MAP[this.data.type] || DEFAULT_COLOR;
+ var key = this.data.plain ? 'color' : 'background-color';
+ var style = (_a = {}, _a[key] = color, _a);
+ if (this.data.textColor) {
+ style.color = this.data.textColor;
+ }
+ return Object.keys(style).map(function (key) { return key + ": " + style[key]; }).join(';');
+ }
+ }
+});
diff --git a/lib/tag/index.json b/lib/tag/index.json
new file mode 100644
index 00000000..32640e0d
--- /dev/null
+++ b/lib/tag/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
\ No newline at end of file
diff --git a/lib/tag/index.wxml b/lib/tag/index.wxml
new file mode 100644
index 00000000..e66580cd
--- /dev/null
+++ b/lib/tag/index.wxml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/lib/tag/index.wxss b/lib/tag/index.wxss
new file mode 100644
index 00000000..fbd8fad7
--- /dev/null
+++ b/lib/tag/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-tag{color:#fff;font-size:10px;padding:.2em .5em;line-height:normal;border-radius:.2em;display:inline-block}.van-tag:after{border-color:currentColor;border-radius:.4em}.van-tag--mark{padding-right:.6em;border-radius:0 .8em .8em 0}.van-tag--mark:after{border-radius:0 1.6em 1.6em 0}.van-tag--round{border-radius:.8em}.van-tag--round:after{border-radius:1.6em}.van-tag--medium{font-size:12px}.van-tag--large{font-size:14px}
\ No newline at end of file
diff --git a/lib/toast/index.js b/lib/toast/index.js
new file mode 100644
index 00000000..ccecefe9
--- /dev/null
+++ b/lib/toast/index.js
@@ -0,0 +1,36 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+component_1.VantComponent({
+ props: {
+ show: Boolean,
+ mask: Boolean,
+ message: String,
+ forbidClick: Boolean,
+ zIndex: {
+ type: Number,
+ value: 1000
+ },
+ type: {
+ type: String,
+ value: 'text'
+ },
+ loadingType: {
+ type: String,
+ value: 'circular'
+ },
+ position: {
+ type: String,
+ value: 'middle'
+ }
+ },
+ methods: {
+ clear: function () {
+ this.set({
+ show: false
+ });
+ },
+ // for prevent touchmove
+ noop: function () { }
+ }
+});
diff --git a/lib/toast/index.json b/lib/toast/index.json
new file mode 100644
index 00000000..9b1b78c4
--- /dev/null
+++ b/lib/toast/index.json
@@ -0,0 +1,9 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index",
+ "van-loading": "../loading/index",
+ "van-overlay": "../overlay/index",
+ "van-transition": "../transition/index"
+ }
+}
diff --git a/lib/toast/index.wxml b/lib/toast/index.wxml
new file mode 100644
index 00000000..1158d2e1
--- /dev/null
+++ b/lib/toast/index.wxml
@@ -0,0 +1,31 @@
+
+
+
+
+ {{ message }}
+
+
+
+
+
+ {{ message }}
+
+
+
diff --git a/lib/toast/index.wxss b/lib/toast/index.wxss
new file mode 100644
index 00000000..c1736205
--- /dev/null
+++ b/lib/toast/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;color:#fff;font-size:14px;line-height:20px;border-radius:4px;word-break:break-all;-webkit-align-items:center;align-items:center;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center;box-sizing:initial;background-color:rgba(51,51,51,.88);white-space:pre-wrap}.van-toast__container{position:fixed;top:50%;left:50%;max-width:70%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-toast--text{padding:8px 12px;min-width:96px}.van-toast--icon{width:90px;padding:15px;min-height:90px}.van-toast--icon .van-toast__icon{font-size:48px}.van-toast--icon .van-toast__text{padding-top:5px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)}
\ No newline at end of file
diff --git a/lib/toast/toast.js b/lib/toast/toast.js
new file mode 100644
index 00000000..0dfcad10
--- /dev/null
+++ b/lib/toast/toast.js
@@ -0,0 +1,74 @@
+"use strict";
+var __assign = (this && this.__assign) || function () {
+ __assign = Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+var utils_1 = require("../common/utils");
+var defaultOptions = {
+ type: 'text',
+ mask: false,
+ message: '',
+ show: true,
+ zIndex: 1000,
+ duration: 3000,
+ position: 'middle',
+ forbidClick: false,
+ loadingType: 'circular',
+ selector: '#van-toast'
+};
+var queue = [];
+var currentOptions = __assign({}, defaultOptions);
+function parseOptions(message) {
+ return utils_1.isObj(message) ? message : { message: message };
+}
+function getContext() {
+ var pages = getCurrentPages();
+ return pages[pages.length - 1];
+}
+var Toast = function (options) {
+ if (options === void 0) { options = {}; }
+ options = __assign({}, currentOptions, parseOptions(options));
+ var context = options.context || getContext();
+ var toast = context.selectComponent(options.selector);
+ if (!toast) {
+ console.warn('未找到 van-toast 节点,请确认 selector 及 context 是否正确');
+ return;
+ }
+ delete options.context;
+ delete options.selector;
+ queue.push(toast);
+ toast.set(options);
+ clearTimeout(toast.timer);
+ if (options.duration > 0) {
+ toast.timer = setTimeout(function () {
+ toast.clear();
+ queue = queue.filter(function (item) { return item !== toast; });
+ }, options.duration);
+ }
+ return toast;
+};
+var createMethod = function (type) { return function (options) { return Toast(__assign({ type: type }, parseOptions(options))); }; };
+['loading', 'success', 'fail'].forEach(function (method) {
+ Toast[method] = createMethod(method);
+});
+Toast.clear = function () {
+ queue.forEach(function (toast) {
+ toast.clear();
+ });
+ queue = [];
+};
+Toast.setDefaultOptions = function (options) {
+ Object.assign(currentOptions, options);
+};
+Toast.resetDefaultOptions = function () {
+ currentOptions = __assign({}, defaultOptions);
+};
+exports.default = Toast;
diff --git a/lib/transition/index.js b/lib/transition/index.js
new file mode 100644
index 00000000..d3f6c378
--- /dev/null
+++ b/lib/transition/index.js
@@ -0,0 +1,15 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var transition_1 = require("../mixins/transition");
+component_1.VantComponent({
+ classes: [
+ 'enter-class',
+ 'enter-active-class',
+ 'enter-to-class',
+ 'leave-class',
+ 'leave-active-class',
+ 'leave-to-class'
+ ],
+ mixins: [transition_1.transition(true)]
+});
diff --git a/lib/transition/index.json b/lib/transition/index.json
new file mode 100644
index 00000000..32640e0d
--- /dev/null
+++ b/lib/transition/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
\ No newline at end of file
diff --git a/lib/transition/index.wxml b/lib/transition/index.wxml
new file mode 100644
index 00000000..412e8afc
--- /dev/null
+++ b/lib/transition/index.wxml
@@ -0,0 +1,8 @@
+
+
+
diff --git a/lib/transition/index.wxss b/lib/transition/index.wxss
new file mode 100644
index 00000000..adcbc5f6
--- /dev/null
+++ b/lib/transition/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-transition{transition-timing-function:ease}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-fade-down-enter-active,.van-fade-down-leave-active,.van-fade-left-enter-active,.van-fade-left-leave-active,.van-fade-right-enter-active,.van-fade-right-leave-active,.van-fade-up-enter-active,.van-fade-up-leave-active{transition-property:opacity,-webkit-transform;transition-property:opacity,transform;transition-property:opacity,transform,-webkit-transform}.van-fade-up-enter,.van-fade-up-leave-to{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}.van-fade-down-enter,.van-fade-down-leave-to{opacity:0;-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}.van-fade-left-enter,.van-fade-left-leave-to{opacity:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.van-fade-right-enter,.van-fade-right-leave-to{opacity:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.van-slide-down-enter-active,.van-slide-down-leave-active,.van-slide-left-enter-active,.van-slide-left-leave-active,.van-slide-right-enter-active,.van-slide-right-leave-active,.van-slide-up-enter-active,.van-slide-up-leave-active{transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-slide-up-enter,.van-slide-up-leave-to{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}.van-slide-down-enter,.van-slide-down-leave-to{-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}.van-slide-left-enter,.van-slide-left-leave-to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.van-slide-right-enter,.van-slide-right-leave-to{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}
\ No newline at end of file
diff --git a/lib/tree-select/index.js b/lib/tree-select/index.js
new file mode 100644
index 00000000..b4465ef3
--- /dev/null
+++ b/lib/tree-select/index.js
@@ -0,0 +1,81 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var component_1 = require("../common/component");
+var ITEM_HEIGHT = 44;
+component_1.VantComponent({
+ classes: [
+ 'main-item-class',
+ 'content-item-class',
+ 'main-active-class',
+ 'content-active-class',
+ 'main-disabled-class',
+ 'content-disabled-class'
+ ],
+ props: {
+ items: Array,
+ mainActiveIndex: {
+ type: Number,
+ value: 0
+ },
+ activeId: {
+ type: [Number, String]
+ },
+ maxHeight: {
+ type: Number,
+ value: 300
+ }
+ },
+ data: {
+ subItems: [],
+ mainHeight: 0,
+ itemHeight: 0
+ },
+ watch: {
+ items: function () {
+ var _this = this;
+ this.updateSubItems().then(function () {
+ _this.updateMainHeight();
+ });
+ },
+ maxHeight: function () {
+ this.updateItemHeight(this.data.subItems);
+ this.updateMainHeight();
+ },
+ mainActiveIndex: 'updateSubItems'
+ },
+ methods: {
+ // 当一个子项被选择时
+ onSelectItem: function (event) {
+ var item = event.currentTarget.dataset.item;
+ if (!item.disabled) {
+ this.$emit('click-item', item);
+ }
+ },
+ // 当一个导航被点击时
+ onClickNav: function (event) {
+ var index = event.currentTarget.dataset.index;
+ var item = this.data.items[index];
+ if (!item.disabled) {
+ this.$emit('click-nav', { index: index });
+ }
+ },
+ // 更新子项列表
+ updateSubItems: function () {
+ var _a = this.data, items = _a.items, mainActiveIndex = _a.mainActiveIndex;
+ var _b = (items[mainActiveIndex] || {}).children, children = _b === void 0 ? [] : _b;
+ this.updateItemHeight(children);
+ return this.set({ subItems: children });
+ },
+ // 更新组件整体高度,根据最大高度和当前组件需要展示的高度来决定
+ updateMainHeight: function () {
+ var _a = this.data, _b = _a.items, items = _b === void 0 ? [] : _b, _c = _a.subItems, subItems = _c === void 0 ? [] : _c;
+ var maxHeight = Math.max(items.length * ITEM_HEIGHT, subItems.length * ITEM_HEIGHT);
+ this.set({ mainHeight: Math.min(maxHeight, this.data.maxHeight) });
+ },
+ // 更新子项列表高度,根据可展示的最大高度和当前子项列表的高度决定
+ updateItemHeight: function (subItems) {
+ var itemHeight = Math.min(subItems.length * ITEM_HEIGHT, this.data.maxHeight);
+ return this.set({ itemHeight: itemHeight });
+ }
+ }
+});
diff --git a/lib/tree-select/index.json b/lib/tree-select/index.json
new file mode 100644
index 00000000..d2a8d90e
--- /dev/null
+++ b/lib/tree-select/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-icon": "../icon/index",
+ "van-cell": "../cell/index"
+ }
+}
diff --git a/lib/tree-select/index.wxml b/lib/tree-select/index.wxml
new file mode 100644
index 00000000..e1f25b50
--- /dev/null
+++ b/lib/tree-select/index.wxml
@@ -0,0 +1,39 @@
+
+
+
+
+
+ {{ item.text }}
+
+
+
+
+ {{ item.text }}
+
+
+
+
diff --git a/lib/tree-select/index.wxss b/lib/tree-select/index.wxss
new file mode 100644
index 00000000..da723a47
--- /dev/null
+++ b/lib/tree-select/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-tree-select{position:relative;font-size:14px;-webkit-user-select:none;user-select:none}.van-tree-select__nav{position:absolute;top:0;bottom:0;left:0;width:35%;min-width:120px;background-color:#fafafa}.van-tree-select__nitem{position:relative;padding:0 9px 0 15px;line-height:44px}.van-tree-select__nitem--active:after{position:absolute;top:0;bottom:0;left:0;width:3.6px;background-color:#f44;content:""}.van-tree-select__nitem--active{font-weight:700;background-color:#fff}.van-tree-select__nitem--disabled{color:#999}.van-tree-select__content{width:65%;padding-left:15px;margin-left:35%;background-color:#fff;box-sizing:border-box}.van-tree-select__item{position:relative;font-weight:700;line-height:44px}.van-tree-select__item--active{color:#f44}.van-tree-select__item--disabled{color:#999}.van-tree-select__selected{position:absolute;top:0;right:15px;bottom:0;height:24px;margin:auto 0;line-height:24px}
\ No newline at end of file
diff --git a/lib/wxs/array.wxs b/lib/wxs/array.wxs
new file mode 100644
index 00000000..610089cd
--- /dev/null
+++ b/lib/wxs/array.wxs
@@ -0,0 +1,5 @@
+function isArray(array) {
+ return array && array.constructor === 'Array';
+}
+
+module.exports.isArray = isArray;
diff --git a/lib/wxs/bem.wxs b/lib/wxs/bem.wxs
new file mode 100644
index 00000000..93b2777b
--- /dev/null
+++ b/lib/wxs/bem.wxs
@@ -0,0 +1,38 @@
+var array = require('./array.wxs');
+var object = require('./object.wxs');
+var PREFIX = 'van-';
+
+function join(name, mods) {
+ name = PREFIX + name;
+ mods = mods.map(function(mod) {
+ return name + '--' + mod;
+ });
+ mods.unshift(name);
+ return mods.join(' ');
+}
+
+function traversing(mods, conf) {
+ if (!conf) {
+ return;
+ }
+
+ if (typeof conf === 'string' || typeof conf === 'number') {
+ mods.push(conf);
+ } else if (array.isArray(conf)) {
+ conf.forEach(function(item) {
+ traversing(mods, item);
+ });
+ } else if (typeof conf === 'object') {
+ object.keys(conf).forEach(function(key) {
+ conf[key] && mods.push(key);
+ });
+ }
+}
+
+function bem(name, conf) {
+ var mods = [];
+ traversing(mods, conf);
+ return join(name, mods);
+}
+
+module.exports.bem = bem;
diff --git a/lib/wxs/memoize.wxs b/lib/wxs/memoize.wxs
new file mode 100644
index 00000000..261ae67d
--- /dev/null
+++ b/lib/wxs/memoize.wxs
@@ -0,0 +1,54 @@
+/**
+ * Simple memoize
+ * wxs doesn't support fn.apply, so this memoize only support up to 2 args
+ */
+
+function isPrimitive(value) {
+ var type = typeof value;
+ return (
+ type === 'boolean' ||
+ type === 'number' ||
+ type === 'string' ||
+ type === 'undefined' ||
+ value === null
+ );
+}
+
+// mock simple fn.call in wxs
+function call(fn, args) {
+ if (args.length === 2) {
+ return fn(args[0], args[1]);
+ }
+
+ if (args.length === 1) {
+ return fn(args[0]);
+ }
+
+ return fn();
+}
+
+function serializer(args) {
+ if (args.length === 1 && isPrimitive(args[0])) {
+ return args[0];
+ }
+ var obj = {};
+ for (var i = 0; i < args.length; i++) {
+ obj['key' + i] = args[i];
+ }
+ return JSON.stringify(obj);
+}
+
+function memoize(fn) {
+ var cache = {};
+
+ return function() {
+ var key = serializer(arguments);
+ if (cache[key] === undefined) {
+ cache[key] = call(fn, arguments);
+ }
+
+ return cache[key];
+ };
+}
+
+module.exports.memoize = memoize;
diff --git a/lib/wxs/object.wxs b/lib/wxs/object.wxs
new file mode 100644
index 00000000..e0771077
--- /dev/null
+++ b/lib/wxs/object.wxs
@@ -0,0 +1,13 @@
+/* eslint-disable */
+var REGEXP = getRegExp('{|}|"', 'g');
+
+function keys(obj) {
+ return JSON.stringify(obj)
+ .replace(REGEXP, '')
+ .split(',')
+ .map(function(item) {
+ return item.split(':')[0];
+ });
+}
+
+module.exports.keys = keys;
diff --git a/lib/wxs/utils.wxs b/lib/wxs/utils.wxs
new file mode 100644
index 00000000..8cced70f
--- /dev/null
+++ b/lib/wxs/utils.wxs
@@ -0,0 +1,12 @@
+var bem = require('./bem.wxs').bem;
+var memoize = require('./memoize.wxs').memoize;
+
+function isSrc(url) {
+ return url.indexOf('http') === 0 || url.indexOf('data:image') === 0 || url.indexOf('//') === 0;
+}
+
+module.exports = {
+ bem: memoize(bem),
+ isSrc: isSrc,
+ memoize: memoize
+};