mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
build: compile 1.0.7
This commit is contained in:
parent
a54f0af5dd
commit
d59413f0eb
54
dist/dropdown-item/index.js
vendored
54
dist/dropdown-item/index.js
vendored
@ -7,7 +7,7 @@ VantComponent({
|
|||||||
current: 'dropdown-item',
|
current: 'dropdown-item',
|
||||||
linked() {
|
linked() {
|
||||||
this.updateDataFromParent();
|
this.updateDataFromParent();
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
@ -27,7 +27,8 @@ VantComponent({
|
|||||||
type: Array,
|
type: Array,
|
||||||
value: [],
|
value: [],
|
||||||
observer: 'rerender'
|
observer: 'rerender'
|
||||||
}
|
},
|
||||||
|
popupStyle: String
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
transition: true,
|
transition: true,
|
||||||
@ -53,50 +54,51 @@ VantComponent({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClickOverlay() {
|
onOpen() {
|
||||||
this.toggle();
|
this.$emit('open');
|
||||||
|
},
|
||||||
|
onOpened() {
|
||||||
|
this.$emit('opened');
|
||||||
|
},
|
||||||
|
onClose() {
|
||||||
this.$emit('close');
|
this.$emit('close');
|
||||||
},
|
},
|
||||||
|
onClosed() {
|
||||||
|
this.$emit('closed');
|
||||||
|
this.setData({ showWrapper: false });
|
||||||
|
},
|
||||||
onOptionTap(event) {
|
onOptionTap(event) {
|
||||||
const { option } = event.currentTarget.dataset;
|
const { option } = event.currentTarget.dataset;
|
||||||
const { value } = option;
|
const { value } = option;
|
||||||
const shouldEmitChange = this.data.value !== value;
|
const shouldEmitChange = this.data.value !== value;
|
||||||
this.setData({ showPopup: false, value });
|
this.setData({ showPopup: false, value });
|
||||||
this.$emit('close');
|
this.$emit('close');
|
||||||
setTimeout(() => {
|
|
||||||
this.setData({ showWrapper: false });
|
|
||||||
}, this.data.duration || 0);
|
|
||||||
this.rerender();
|
this.rerender();
|
||||||
if (shouldEmitChange) {
|
if (shouldEmitChange) {
|
||||||
this.$emit('change', value);
|
this.$emit('change', value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggle(show, options = {}) {
|
toggle(show, options = {}) {
|
||||||
const { showPopup, duration } = this.data;
|
const { showPopup } = this.data;
|
||||||
if (show == null) {
|
if (typeof show !== 'boolean') {
|
||||||
show = !showPopup;
|
show = !showPopup;
|
||||||
}
|
}
|
||||||
if (show === showPopup) {
|
if (show === showPopup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!show) {
|
this.setData({
|
||||||
const time = options.immediate ? 0 : duration;
|
transition: !options.immediate,
|
||||||
this.setData({ transition: !options.immediate, showPopup: show });
|
showPopup: show,
|
||||||
setTimeout(() => {
|
|
||||||
this.setData({ showWrapper: false });
|
|
||||||
}, time);
|
|
||||||
this.rerender();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.parent.getChildWrapperStyle().then((wrapperStyle = '') => {
|
|
||||||
this.setData({
|
|
||||||
transition: !options.immediate,
|
|
||||||
showPopup: show,
|
|
||||||
wrapperStyle,
|
|
||||||
showWrapper: true
|
|
||||||
});
|
|
||||||
this.rerender();
|
|
||||||
});
|
});
|
||||||
|
if (show) {
|
||||||
|
this.parent.getChildWrapperStyle().then((wrapperStyle) => {
|
||||||
|
this.setData({ wrapperStyle, showWrapper: true });
|
||||||
|
this.rerender();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.rerender();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
8
dist/dropdown-item/index.wxml
vendored
8
dist/dropdown-item/index.wxml
vendored
@ -7,13 +7,17 @@
|
|||||||
>
|
>
|
||||||
<van-popup
|
<van-popup
|
||||||
show="{{ showPopup }}"
|
show="{{ showPopup }}"
|
||||||
custom-style="position: absolute;"
|
custom-style="position: absolute;{{ popupStyle }}"
|
||||||
overlay-style="position: absolute;"
|
overlay-style="position: absolute;"
|
||||||
overlay="{{ overlay }}"
|
overlay="{{ overlay }}"
|
||||||
position="{{ direction === 'down' ? 'top' : 'bottom' }}"
|
position="{{ direction === 'down' ? 'top' : 'bottom' }}"
|
||||||
duration="{{ transition ? duration : 0 }}"
|
duration="{{ transition ? duration : 0 }}"
|
||||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||||
bind:close="onClickOverlay"
|
bind:enter="onOpen"
|
||||||
|
bind:leave="onClose"
|
||||||
|
bind:close="toggle"
|
||||||
|
bind:after-enter="onOpened"
|
||||||
|
bind:after-leave="onClosed"
|
||||||
>
|
>
|
||||||
<van-cell
|
<van-cell
|
||||||
wx:for="{{ options }}"
|
wx:for="{{ options }}"
|
||||||
|
2
dist/goods-action-button/index.wxss
vendored
2
dist/goods-action-button/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{--button-warning-background-color:linear-gradient(90deg,#ffd01e,#ff8917);--button-warning-background-color:var(--goods-action-button-warning-color,linear-gradient(90deg,#ffd01e,#ff8917));--button-danger-background-color:linear-gradient(90deg,#ff6034,#ee0a24);--button-danger-background-color:var(--goods-action-button-danger-color,linear-gradient(90deg,#ff6034,#ee0a24));--button-default-height:40px;--button-default-height:var(--goods-action-button-height,40px);--button-line-height:40px;--button-line-height:var(--goods-action-button-height,40px);--button-plain-background-color:#fff;--button-plain-background-color:var(--goods-action-button-plain-color,#fff);display:block;--button-border-width:0}.van-goods-action-button--first{margin-left:5px;--button-border-radius:20px 0 0 20px;--button-border-radius:var(--goods-action-button-border-radius,20px) 0 0 var(--goods-action-button-border-radius,20px)}.van-goods-action-button--last{margin-right:5px;--button-border-radius:0 20px 20px 0;--button-border-radius:0 var(--goods-action-button-border-radius,20px) var(--goods-action-button-border-radius,20px) 0}.van-goods-action-button--plain{--button-border-width:1px}.van-goods-action-button__inner{width:100%;font-weight:500!important;font-weight:var(--font-weight-bold,500)!important}@media (max-width:321px){.van-goods-action-button{font-size:13px}}
|
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{--button-warning-background-color:linear-gradient(90deg,#ffd01e,#ff8917);--button-warning-background-color:var(--goods-action-button-warning-color,linear-gradient(90deg,#ffd01e,#ff8917));--button-danger-background-color:linear-gradient(90deg,#ff6034,#ee0a24);--button-danger-background-color:var(--goods-action-button-danger-color,linear-gradient(90deg,#ff6034,#ee0a24));--button-default-height:40px;--button-default-height:var(--goods-action-button-height,40px);--button-line-height:40px;--button-line-height:var(--goods-action-button-height,40px);--button-plain-background-color:#fff;--button-plain-background-color:var(--goods-action-button-plain-color,#fff);display:block;--button-border-width:0}.van-goods-action-button--first{margin-left:5px;--button-border-radius:20px 0 0 20px;--button-border-radius:var(--goods-action-button-border-radius,20px) 0 0 var(--goods-action-button-border-radius,20px)}.van-goods-action-button--last{margin-right:5px;--button-border-radius:0 20px 20px 0;--button-border-radius:0 var(--goods-action-button-border-radius,20px) var(--goods-action-button-border-radius,20px) 0}.van-goods-action-button--first.van-goods-action-button--last{--button-border-radius:20px;--button-border-radius:var(--goods-action-button-border-radius,20px)}.van-goods-action-button--plain{--button-border-width:1px}.van-goods-action-button__inner{width:100%;font-weight:500!important;font-weight:var(--font-weight-bold,500)!important}@media (max-width:321px){.van-goods-action-button{font-size:13px}}
|
10
dist/mixins/transition.js
vendored
10
dist/mixins/transition.js
vendored
@ -32,13 +32,11 @@ export const transition = function (showDefaultValue) {
|
|||||||
inited: false,
|
inited: false,
|
||||||
display: false
|
display: false
|
||||||
},
|
},
|
||||||
attached() {
|
|
||||||
if (this.data.show) {
|
|
||||||
this.enter();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
observeShow(value) {
|
observeShow(value, old) {
|
||||||
|
if (value === old) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
value ? this.enter() : this.leave();
|
value ? this.enter() : this.leave();
|
||||||
},
|
},
|
||||||
enter() {
|
enter() {
|
||||||
|
28
dist/picker/index.wxml
vendored
28
dist/picker/index.wxml
vendored
@ -1,29 +1,4 @@
|
|||||||
<template name="toolbar">
|
<import src="./toolbar" />
|
||||||
<view
|
|
||||||
wx:if="{{ showToolbar }}"
|
|
||||||
class="van-picker__toolbar van-hairline--top-bottom toolbar-class"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
class="van-picker__cancel"
|
|
||||||
hover-class="van-picker__cancel--hover"
|
|
||||||
hover-stay-time="70"
|
|
||||||
data-type="cancel"
|
|
||||||
bindtap="emit"
|
|
||||||
>
|
|
||||||
{{ cancelButtonText }}
|
|
||||||
</view>
|
|
||||||
<view wx:if="{{ title }}" class="van-picker__title van-ellipsis">{{ title }}</view>
|
|
||||||
<view
|
|
||||||
class="van-picker__confirm"
|
|
||||||
hover-class="van-picker__confirm--hover"
|
|
||||||
hover-stay-time="70"
|
|
||||||
data-type="confirm"
|
|
||||||
bindtap="emit"
|
|
||||||
>
|
|
||||||
{{ confirmButtonText }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<view class="van-picker custom-class">
|
<view class="van-picker custom-class">
|
||||||
<template is="toolbar" wx:if="{{ toolbarPosition === 'top' }}" data="{{ showToolbar, cancelButtonText, title, confirmButtonText }}"></template>
|
<template is="toolbar" wx:if="{{ toolbarPosition === 'top' }}" data="{{ showToolbar, cancelButtonText, title, confirmButtonText }}"></template>
|
||||||
@ -49,6 +24,7 @@
|
|||||||
active-class="active-class"
|
active-class="active-class"
|
||||||
bind:change="onChange"
|
bind:change="onChange"
|
||||||
/>
|
/>
|
||||||
|
<view class="van-picker__mask" style="background-size: 100% {{ (itemHeight * visibleItemCount - itemHeight) / 2 }}px" />
|
||||||
<view
|
<view
|
||||||
class="van-picker__frame van-hairline--top-bottom"
|
class="van-picker__frame van-hairline--top-bottom"
|
||||||
style="height: {{ itemHeight }}px"
|
style="height: {{ itemHeight }}px"
|
||||||
|
2
dist/picker/index.wxss
vendored
2
dist/picker/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-picker{position:relative;overflow:hidden;-webkit-text-size-adjust:100%;-webkit-user-select:none;user-select:none;background-color:#fff;background-color:var(--picker-background-color,#fff)}.van-picker__toolbar{display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;height:44px;height:var(--picker-toolbar-height,44px);line-height:44px;line-height:var(--picker-toolbar-height,44px)}.van-picker__cancel,.van-picker__confirm{padding:0 16px;padding:var(--picker-action-padding,0 16px);font-size:14px;font-size:var(--picker-action-font-size,14px);color:#1989fa;color:var(--picker-action-text-color,#1989fa)}.van-picker__cancel--hover,.van-picker__confirm--hover{background-color:#f2f3f5;background-color:var(--picker-action-active-color,#f2f3f5)}.van-picker__title{max-width:50%;text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--picker-option-font-size,16px)}.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;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;background-color:hsla(0,0%,100%,.9);background-color:var(--picker-loading-mask-color,hsla(0,0%,100%,.9))}.van-picker__frame,.van-picker__loading .van-loading{position:absolute;top:50%;left:0;z-index:1;width:100%;-webkit-transform:translateY(-50%);transform:translateY(-50%);pointer-events:none}
|
@import '../common/index.wxss';.van-picker{position:relative;overflow:hidden;-webkit-text-size-adjust:100%;-webkit-user-select:none;user-select:none;background-color:#fff;background-color:var(--picker-background-color,#fff)}.van-picker__toolbar{display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;height:44px;height:var(--picker-toolbar-height,44px);line-height:44px;line-height:var(--picker-toolbar-height,44px)}.van-picker__cancel,.van-picker__confirm{padding:0 16px;padding:var(--picker-action-padding,0 16px);font-size:14px;font-size:var(--picker-action-font-size,14px);color:#1989fa;color:var(--picker-action-text-color,#1989fa)}.van-picker__cancel--hover,.van-picker__confirm--hover{background-color:#f2f3f5;background-color:var(--picker-action-active-color,#f2f3f5)}.van-picker__title{max-width:50%;text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--picker-option-font-size,16px)}.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;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;background-color:hsla(0,0%,100%,.9);background-color:var(--picker-loading-mask-color,hsla(0,0%,100%,.9))}.van-picker__mask{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;background-image:linear-gradient(180deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4)),linear-gradient(0deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4));background-repeat:no-repeat;background-position:top,bottom;-webkit-backface-visibility:hidden;backface-visibility:hidden;pointer-events:none}.van-picker__frame,.van-picker__loading .van-loading{position:absolute;top:50%;left:0;z-index:1;width:100%;-webkit-transform:translateY(-50%);transform:translateY(-50%);pointer-events:none}
|
28
dist/picker/toolbar.wxml
vendored
Normal file
28
dist/picker/toolbar.wxml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<template name="toolbar">
|
||||||
|
<view
|
||||||
|
wx:if="{{ showToolbar }}"
|
||||||
|
class="van-picker__toolbar van-hairline--top-bottom toolbar-class"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="van-picker__cancel"
|
||||||
|
hover-class="van-picker__cancel--hover"
|
||||||
|
hover-stay-time="70"
|
||||||
|
data-type="cancel"
|
||||||
|
bindtap="emit"
|
||||||
|
>
|
||||||
|
{{ cancelButtonText }}
|
||||||
|
</view>
|
||||||
|
<view wx:if="{{ title }}" class="van-picker__title van-ellipsis">{{
|
||||||
|
title
|
||||||
|
}}</view>
|
||||||
|
<view
|
||||||
|
class="van-picker__confirm"
|
||||||
|
hover-class="van-picker__confirm--hover"
|
||||||
|
hover-stay-time="70"
|
||||||
|
data-type="confirm"
|
||||||
|
bindtap="emit"
|
||||||
|
>
|
||||||
|
{{ confirmButtonText }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
1
dist/radio/index.js
vendored
1
dist/radio/index.js
vendored
@ -8,6 +8,7 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
classes: ['icon-class', 'label-class'],
|
classes: ['icon-class', 'label-class'],
|
||||||
props: {
|
props: {
|
||||||
|
name: null,
|
||||||
value: null,
|
value: null,
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
useIconSlot: Boolean,
|
useIconSlot: Boolean,
|
||||||
|
10
dist/sticky/index.js
vendored
10
dist/sticky/index.js
vendored
@ -27,6 +27,7 @@ VantComponent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.observeContainer();
|
this.observeContainer();
|
||||||
|
this.updateFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -49,6 +50,15 @@ VantComponent({
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
updateFixed() {
|
||||||
|
Promise.all([this.getRect(ROOT_ELEMENT), this.getContainerRect()]).then(([content, container]) => {
|
||||||
|
this.setData({ height: content.height });
|
||||||
|
this.containerHeight = container.height;
|
||||||
|
wx.nextTick(() => {
|
||||||
|
this.setFixed(content.top);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
disconnectObserver(observerName) {
|
disconnectObserver(observerName) {
|
||||||
if (observerName) {
|
if (observerName) {
|
||||||
const observer = this[observerName];
|
const observer = this[observerName];
|
||||||
|
10
dist/tabs/index.js
vendored
10
dist/tabs/index.js
vendored
@ -103,14 +103,17 @@ VantComponent({
|
|||||||
container: null
|
container: null
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.setData({
|
wx.nextTick(() => {
|
||||||
container: () => this.createSelectorQuery().select('.van-tabs')
|
|
||||||
}, () => {
|
|
||||||
this.setLine(true);
|
this.setLine(true);
|
||||||
this.scrollIntoView();
|
this.scrollIntoView();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
updateContainer() {
|
||||||
|
this.setData({
|
||||||
|
container: () => this.createSelectorQuery().select('.van-tabs')
|
||||||
|
});
|
||||||
|
},
|
||||||
updateTabs() {
|
updateTabs() {
|
||||||
const { children = [], data } = this;
|
const { children = [], data } = this;
|
||||||
this.setData({
|
this.setData({
|
||||||
@ -173,6 +176,7 @@ VantComponent({
|
|||||||
wx.nextTick(() => {
|
wx.nextTick(() => {
|
||||||
this.setLine();
|
this.setLine();
|
||||||
this.scrollIntoView();
|
this.scrollIntoView();
|
||||||
|
this.updateContainer();
|
||||||
this.trigger('input');
|
this.trigger('input');
|
||||||
if (shouldEmitChange) {
|
if (shouldEmitChange) {
|
||||||
this.trigger('change');
|
this.trigger('change');
|
||||||
|
@ -9,7 +9,7 @@ component_1.VantComponent({
|
|||||||
current: 'dropdown-item',
|
current: 'dropdown-item',
|
||||||
linked: function () {
|
linked: function () {
|
||||||
this.updateDataFromParent();
|
this.updateDataFromParent();
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
@ -29,7 +29,8 @@ component_1.VantComponent({
|
|||||||
type: Array,
|
type: Array,
|
||||||
value: [],
|
value: [],
|
||||||
observer: 'rerender'
|
observer: 'rerender'
|
||||||
}
|
},
|
||||||
|
popupStyle: String
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
transition: true,
|
transition: true,
|
||||||
@ -56,20 +57,25 @@ component_1.VantComponent({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClickOverlay: function () {
|
onOpen: function () {
|
||||||
this.toggle();
|
this.$emit('open');
|
||||||
|
},
|
||||||
|
onOpened: function () {
|
||||||
|
this.$emit('opened');
|
||||||
|
},
|
||||||
|
onClose: function () {
|
||||||
this.$emit('close');
|
this.$emit('close');
|
||||||
},
|
},
|
||||||
|
onClosed: function () {
|
||||||
|
this.$emit('closed');
|
||||||
|
this.setData({ showWrapper: false });
|
||||||
|
},
|
||||||
onOptionTap: function (event) {
|
onOptionTap: function (event) {
|
||||||
var _this = this;
|
|
||||||
var option = event.currentTarget.dataset.option;
|
var option = event.currentTarget.dataset.option;
|
||||||
var value = option.value;
|
var value = option.value;
|
||||||
var shouldEmitChange = this.data.value !== value;
|
var shouldEmitChange = this.data.value !== value;
|
||||||
this.setData({ showPopup: false, value: value });
|
this.setData({ showPopup: false, value: value });
|
||||||
this.$emit('close');
|
this.$emit('close');
|
||||||
setTimeout(function () {
|
|
||||||
_this.setData({ showWrapper: false });
|
|
||||||
}, this.data.duration || 0);
|
|
||||||
this.rerender();
|
this.rerender();
|
||||||
if (shouldEmitChange) {
|
if (shouldEmitChange) {
|
||||||
this.$emit('change', value);
|
this.$emit('change', value);
|
||||||
@ -78,32 +84,26 @@ component_1.VantComponent({
|
|||||||
toggle: function (show, options) {
|
toggle: function (show, options) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
if (options === void 0) { options = {}; }
|
if (options === void 0) { options = {}; }
|
||||||
var _a = this.data, showPopup = _a.showPopup, duration = _a.duration;
|
var showPopup = this.data.showPopup;
|
||||||
if (show == null) {
|
if (typeof show !== 'boolean') {
|
||||||
show = !showPopup;
|
show = !showPopup;
|
||||||
}
|
}
|
||||||
if (show === showPopup) {
|
if (show === showPopup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!show) {
|
this.setData({
|
||||||
var time = options.immediate ? 0 : duration;
|
transition: !options.immediate,
|
||||||
this.setData({ transition: !options.immediate, showPopup: show });
|
showPopup: show,
|
||||||
setTimeout(function () {
|
|
||||||
_this.setData({ showWrapper: false });
|
|
||||||
}, time);
|
|
||||||
this.rerender();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.parent.getChildWrapperStyle().then(function (wrapperStyle) {
|
|
||||||
if (wrapperStyle === void 0) { wrapperStyle = ''; }
|
|
||||||
_this.setData({
|
|
||||||
transition: !options.immediate,
|
|
||||||
showPopup: show,
|
|
||||||
wrapperStyle: wrapperStyle,
|
|
||||||
showWrapper: true
|
|
||||||
});
|
|
||||||
_this.rerender();
|
|
||||||
});
|
});
|
||||||
|
if (show) {
|
||||||
|
this.parent.getChildWrapperStyle().then(function (wrapperStyle) {
|
||||||
|
_this.setData({ wrapperStyle: wrapperStyle, showWrapper: true });
|
||||||
|
_this.rerender();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.rerender();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -7,13 +7,17 @@
|
|||||||
>
|
>
|
||||||
<van-popup
|
<van-popup
|
||||||
show="{{ showPopup }}"
|
show="{{ showPopup }}"
|
||||||
custom-style="position: absolute;"
|
custom-style="position: absolute;{{ popupStyle }}"
|
||||||
overlay-style="position: absolute;"
|
overlay-style="position: absolute;"
|
||||||
overlay="{{ overlay }}"
|
overlay="{{ overlay }}"
|
||||||
position="{{ direction === 'down' ? 'top' : 'bottom' }}"
|
position="{{ direction === 'down' ? 'top' : 'bottom' }}"
|
||||||
duration="{{ transition ? duration : 0 }}"
|
duration="{{ transition ? duration : 0 }}"
|
||||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||||
bind:close="onClickOverlay"
|
bind:enter="onOpen"
|
||||||
|
bind:leave="onClose"
|
||||||
|
bind:close="toggle"
|
||||||
|
bind:after-enter="onOpened"
|
||||||
|
bind:after-leave="onClosed"
|
||||||
>
|
>
|
||||||
<van-cell
|
<van-cell
|
||||||
wx:for="{{ options }}"
|
wx:for="{{ options }}"
|
||||||
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{--button-warning-background-color:linear-gradient(90deg,#ffd01e,#ff8917);--button-warning-background-color:var(--goods-action-button-warning-color,linear-gradient(90deg,#ffd01e,#ff8917));--button-danger-background-color:linear-gradient(90deg,#ff6034,#ee0a24);--button-danger-background-color:var(--goods-action-button-danger-color,linear-gradient(90deg,#ff6034,#ee0a24));--button-default-height:40px;--button-default-height:var(--goods-action-button-height,40px);--button-line-height:40px;--button-line-height:var(--goods-action-button-height,40px);--button-plain-background-color:#fff;--button-plain-background-color:var(--goods-action-button-plain-color,#fff);display:block;--button-border-width:0}.van-goods-action-button--first{margin-left:5px;--button-border-radius:20px 0 0 20px;--button-border-radius:var(--goods-action-button-border-radius,20px) 0 0 var(--goods-action-button-border-radius,20px)}.van-goods-action-button--last{margin-right:5px;--button-border-radius:0 20px 20px 0;--button-border-radius:0 var(--goods-action-button-border-radius,20px) var(--goods-action-button-border-radius,20px) 0}.van-goods-action-button--plain{--button-border-width:1px}.van-goods-action-button__inner{width:100%;font-weight:500!important;font-weight:var(--font-weight-bold,500)!important}@media (max-width:321px){.van-goods-action-button{font-size:13px}}
|
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{--button-warning-background-color:linear-gradient(90deg,#ffd01e,#ff8917);--button-warning-background-color:var(--goods-action-button-warning-color,linear-gradient(90deg,#ffd01e,#ff8917));--button-danger-background-color:linear-gradient(90deg,#ff6034,#ee0a24);--button-danger-background-color:var(--goods-action-button-danger-color,linear-gradient(90deg,#ff6034,#ee0a24));--button-default-height:40px;--button-default-height:var(--goods-action-button-height,40px);--button-line-height:40px;--button-line-height:var(--goods-action-button-height,40px);--button-plain-background-color:#fff;--button-plain-background-color:var(--goods-action-button-plain-color,#fff);display:block;--button-border-width:0}.van-goods-action-button--first{margin-left:5px;--button-border-radius:20px 0 0 20px;--button-border-radius:var(--goods-action-button-border-radius,20px) 0 0 var(--goods-action-button-border-radius,20px)}.van-goods-action-button--last{margin-right:5px;--button-border-radius:0 20px 20px 0;--button-border-radius:0 var(--goods-action-button-border-radius,20px) var(--goods-action-button-border-radius,20px) 0}.van-goods-action-button--first.van-goods-action-button--last{--button-border-radius:20px;--button-border-radius:var(--goods-action-button-border-radius,20px)}.van-goods-action-button--plain{--button-border-width:1px}.van-goods-action-button__inner{width:100%;font-weight:500!important;font-weight:var(--font-weight-bold,500)!important}@media (max-width:321px){.van-goods-action-button{font-size:13px}}
|
@ -34,13 +34,11 @@ exports.transition = function (showDefaultValue) {
|
|||||||
inited: false,
|
inited: false,
|
||||||
display: false
|
display: false
|
||||||
},
|
},
|
||||||
attached: function () {
|
|
||||||
if (this.data.show) {
|
|
||||||
this.enter();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
observeShow: function (value) {
|
observeShow: function (value, old) {
|
||||||
|
if (value === old) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
value ? this.enter() : this.leave();
|
value ? this.enter() : this.leave();
|
||||||
},
|
},
|
||||||
enter: function () {
|
enter: function () {
|
||||||
|
@ -1,29 +1,4 @@
|
|||||||
<template name="toolbar">
|
<import src="./toolbar" />
|
||||||
<view
|
|
||||||
wx:if="{{ showToolbar }}"
|
|
||||||
class="van-picker__toolbar van-hairline--top-bottom toolbar-class"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
class="van-picker__cancel"
|
|
||||||
hover-class="van-picker__cancel--hover"
|
|
||||||
hover-stay-time="70"
|
|
||||||
data-type="cancel"
|
|
||||||
bindtap="emit"
|
|
||||||
>
|
|
||||||
{{ cancelButtonText }}
|
|
||||||
</view>
|
|
||||||
<view wx:if="{{ title }}" class="van-picker__title van-ellipsis">{{ title }}</view>
|
|
||||||
<view
|
|
||||||
class="van-picker__confirm"
|
|
||||||
hover-class="van-picker__confirm--hover"
|
|
||||||
hover-stay-time="70"
|
|
||||||
data-type="confirm"
|
|
||||||
bindtap="emit"
|
|
||||||
>
|
|
||||||
{{ confirmButtonText }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<view class="van-picker custom-class">
|
<view class="van-picker custom-class">
|
||||||
<template is="toolbar" wx:if="{{ toolbarPosition === 'top' }}" data="{{ showToolbar, cancelButtonText, title, confirmButtonText }}"></template>
|
<template is="toolbar" wx:if="{{ toolbarPosition === 'top' }}" data="{{ showToolbar, cancelButtonText, title, confirmButtonText }}"></template>
|
||||||
@ -49,6 +24,7 @@
|
|||||||
active-class="active-class"
|
active-class="active-class"
|
||||||
bind:change="onChange"
|
bind:change="onChange"
|
||||||
/>
|
/>
|
||||||
|
<view class="van-picker__mask" style="background-size: 100% {{ (itemHeight * visibleItemCount - itemHeight) / 2 }}px" />
|
||||||
<view
|
<view
|
||||||
class="van-picker__frame van-hairline--top-bottom"
|
class="van-picker__frame van-hairline--top-bottom"
|
||||||
style="height: {{ itemHeight }}px"
|
style="height: {{ itemHeight }}px"
|
||||||
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-picker{position:relative;overflow:hidden;-webkit-text-size-adjust:100%;-webkit-user-select:none;user-select:none;background-color:#fff;background-color:var(--picker-background-color,#fff)}.van-picker__toolbar{display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;height:44px;height:var(--picker-toolbar-height,44px);line-height:44px;line-height:var(--picker-toolbar-height,44px)}.van-picker__cancel,.van-picker__confirm{padding:0 16px;padding:var(--picker-action-padding,0 16px);font-size:14px;font-size:var(--picker-action-font-size,14px);color:#1989fa;color:var(--picker-action-text-color,#1989fa)}.van-picker__cancel--hover,.van-picker__confirm--hover{background-color:#f2f3f5;background-color:var(--picker-action-active-color,#f2f3f5)}.van-picker__title{max-width:50%;text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--picker-option-font-size,16px)}.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;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;background-color:hsla(0,0%,100%,.9);background-color:var(--picker-loading-mask-color,hsla(0,0%,100%,.9))}.van-picker__frame,.van-picker__loading .van-loading{position:absolute;top:50%;left:0;z-index:1;width:100%;-webkit-transform:translateY(-50%);transform:translateY(-50%);pointer-events:none}
|
@import '../common/index.wxss';.van-picker{position:relative;overflow:hidden;-webkit-text-size-adjust:100%;-webkit-user-select:none;user-select:none;background-color:#fff;background-color:var(--picker-background-color,#fff)}.van-picker__toolbar{display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;height:44px;height:var(--picker-toolbar-height,44px);line-height:44px;line-height:var(--picker-toolbar-height,44px)}.van-picker__cancel,.van-picker__confirm{padding:0 16px;padding:var(--picker-action-padding,0 16px);font-size:14px;font-size:var(--picker-action-font-size,14px);color:#1989fa;color:var(--picker-action-text-color,#1989fa)}.van-picker__cancel--hover,.van-picker__confirm--hover{background-color:#f2f3f5;background-color:var(--picker-action-active-color,#f2f3f5)}.van-picker__title{max-width:50%;text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--picker-option-font-size,16px)}.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;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;background-color:hsla(0,0%,100%,.9);background-color:var(--picker-loading-mask-color,hsla(0,0%,100%,.9))}.van-picker__mask{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;background-image:linear-gradient(180deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4)),linear-gradient(0deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4));background-repeat:no-repeat;background-position:top,bottom;-webkit-backface-visibility:hidden;backface-visibility:hidden;pointer-events:none}.van-picker__frame,.van-picker__loading .van-loading{position:absolute;top:50%;left:0;z-index:1;width:100%;-webkit-transform:translateY(-50%);transform:translateY(-50%);pointer-events:none}
|
28
lib/picker/toolbar.wxml
Normal file
28
lib/picker/toolbar.wxml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<template name="toolbar">
|
||||||
|
<view
|
||||||
|
wx:if="{{ showToolbar }}"
|
||||||
|
class="van-picker__toolbar van-hairline--top-bottom toolbar-class"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="van-picker__cancel"
|
||||||
|
hover-class="van-picker__cancel--hover"
|
||||||
|
hover-stay-time="70"
|
||||||
|
data-type="cancel"
|
||||||
|
bindtap="emit"
|
||||||
|
>
|
||||||
|
{{ cancelButtonText }}
|
||||||
|
</view>
|
||||||
|
<view wx:if="{{ title }}" class="van-picker__title van-ellipsis">{{
|
||||||
|
title
|
||||||
|
}}</view>
|
||||||
|
<view
|
||||||
|
class="van-picker__confirm"
|
||||||
|
hover-class="van-picker__confirm--hover"
|
||||||
|
hover-stay-time="70"
|
||||||
|
data-type="confirm"
|
||||||
|
bindtap="emit"
|
||||||
|
>
|
||||||
|
{{ confirmButtonText }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
@ -10,6 +10,7 @@ component_1.VantComponent({
|
|||||||
},
|
},
|
||||||
classes: ['icon-class', 'label-class'],
|
classes: ['icon-class', 'label-class'],
|
||||||
props: {
|
props: {
|
||||||
|
name: null,
|
||||||
value: null,
|
value: null,
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
useIconSlot: Boolean,
|
useIconSlot: Boolean,
|
||||||
|
@ -29,6 +29,7 @@ component_1.VantComponent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.observeContainer();
|
this.observeContainer();
|
||||||
|
this.updateFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -54,6 +55,17 @@ component_1.VantComponent({
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
updateFixed: function () {
|
||||||
|
var _this = this;
|
||||||
|
Promise.all([this.getRect(ROOT_ELEMENT), this.getContainerRect()]).then(function (_a) {
|
||||||
|
var content = _a[0], container = _a[1];
|
||||||
|
_this.setData({ height: content.height });
|
||||||
|
_this.containerHeight = container.height;
|
||||||
|
wx.nextTick(function () {
|
||||||
|
_this.setFixed(content.top);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
disconnectObserver: function (observerName) {
|
disconnectObserver: function (observerName) {
|
||||||
if (observerName) {
|
if (observerName) {
|
||||||
var observer = this[observerName];
|
var observer = this[observerName];
|
||||||
|
@ -109,14 +109,18 @@ component_1.VantComponent({
|
|||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
this.setData({
|
wx.nextTick(function () {
|
||||||
container: function () { return _this.createSelectorQuery().select('.van-tabs'); }
|
|
||||||
}, function () {
|
|
||||||
_this.setLine(true);
|
_this.setLine(true);
|
||||||
_this.scrollIntoView();
|
_this.scrollIntoView();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
updateContainer: function () {
|
||||||
|
var _this = this;
|
||||||
|
this.setData({
|
||||||
|
container: function () { return _this.createSelectorQuery().select('.van-tabs'); }
|
||||||
|
});
|
||||||
|
},
|
||||||
updateTabs: function () {
|
updateTabs: function () {
|
||||||
var _a = this, _b = _a.children, children = _b === void 0 ? [] : _b, data = _a.data;
|
var _a = this, _b = _a.children, children = _b === void 0 ? [] : _b, data = _a.data;
|
||||||
this.setData({
|
this.setData({
|
||||||
@ -181,6 +185,7 @@ component_1.VantComponent({
|
|||||||
wx.nextTick(function () {
|
wx.nextTick(function () {
|
||||||
_this.setLine();
|
_this.setLine();
|
||||||
_this.scrollIntoView();
|
_this.scrollIntoView();
|
||||||
|
_this.updateContainer();
|
||||||
_this.trigger('input');
|
_this.trigger('input');
|
||||||
if (shouldEmitChange) {
|
if (shouldEmitChange) {
|
||||||
_this.trigger('change');
|
_this.trigger('change');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user