weapp版本升级到1.11.7

"version": "1.11.7"
This commit is contained in:
Abin
2026-01-07 13:54:40 +08:00
parent a3c886146a
commit 66ba21dd7b
67 changed files with 566 additions and 365 deletions
+2 -1
View File
@@ -5,7 +5,8 @@ String.prototype.splice = function(start = 0, deleteCount = 0, addStr = '') {
}
module.exports = {
versionHigherThan(version = '') {
var v1 = wx.getSystemInfoSync().SDKVersion.split('.');
//旧版 var v1 = wx.getSystemInfoSync().SDKVersion.split('.');
var v1 = wx.getAppBaseInfo().SDKVersion.split('.');
var v2 = version.split('.');
const len = Math.max(v1.length, v2.length);
while (v1.length < len) {
@@ -47,6 +47,10 @@ var defaultFieldNames = {
type: Boolean,
value: true,
},
ellipsis: {
type: Boolean,
value: true,
},
showHeader: {
type: Boolean,
value: true,
@@ -161,6 +165,7 @@ var defaultFieldNames = {
selected: null,
},
],
activeTab: 0,
});
},
onClose: function () {
@@ -19,6 +19,7 @@
color="{{ activeColor }}"
border="{{ false }}"
swipeable="{{ swipeable }}"
ellipsis="{{ ellipsis }}"
bind:click="onClickTab"
>
<van-tab
@@ -26,6 +26,7 @@ var animate_1 = require("./animate");
},
data: {
expanded: false,
parentBorder: true,
},
mounted: function () {
this.updateExpanded();
@@ -36,7 +37,7 @@ var animate_1 = require("./animate");
if (!this.parent) {
return;
}
var _a = this.parent.data, value = _a.value, accordion = _a.accordion;
var _a = this.parent.data, value = _a.value, accordion = _a.accordion, border = _a.border;
var _b = this.parent.children, children = _b === void 0 ? [] : _b;
var name = this.data.name;
var index = children.indexOf(this);
@@ -47,7 +48,7 @@ var animate_1 = require("./animate");
if (expanded !== this.data.expanded) {
(0, animate_1.setContentAnimate)(this, expanded, this.mounted);
}
this.setData({ index: index, expanded: expanded });
this.setData({ index: index, expanded: expanded, parentBorder: border });
},
onClick: function () {
if (this.data.disabled) {
@@ -1,6 +1,6 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="van-collapse-item custom-class {{ index !== 0 ? 'van-hairline--top' : '' }}">
<view class="van-collapse-item custom-class {{ index !== 0 && parentBorder ? 'van-hairline--top' : '' }}">
<van-cell
size="{{ size }}"
title="{{ title }}"
@@ -4,7 +4,9 @@ exports.canIUseGetUserProfile = exports.canIUseCanvas2d = exports.canIUseNextTic
var systemInfo;
function getSystemInfoSync() {
if (systemInfo == null) {
systemInfo = wx.getSystemInfoSync();
//旧版 systemInfo = wx.getSystemInfoSync();
systemInfo = wx.getAppBaseInfo();
}
return systemInfo;
}
+1
View File
@@ -4,6 +4,7 @@ interface VantComponentInstance {
children: WechatMiniprogram.Component.TrivialInstance[];
index: number;
$emit: (name: string, detail?: unknown, options?: WechatMiniprogram.Component.TriggerEventOption) => void;
setView: (value: Record<string, any>, callback?: () => void) => void;
}
export type VantComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends WechatMiniprogram.Component.PropertyOption, Methods extends WechatMiniprogram.Component.MethodOption> = {
data?: Data;
+9 -8
View File
@@ -90,15 +90,16 @@ var utils_1 = require("../common/utils");
this.close('overlay');
},
close: function (action) {
var _this = this;
this.setData({ show: false });
wx.nextTick(function () {
_this.$emit('close', action);
var callback = _this.data.callback;
if (callback) {
callback(action, _this);
}
});
this.closeAction = action;
},
onAfterLeave: function () {
var action = this.closeAction;
this.$emit('close', action);
var callback = this.data.callback;
if (callback) {
callback(action, this);
}
},
stopLoading: function () {
this.setData({
@@ -11,6 +11,7 @@
close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay"
bind:after-leave="onAfterLeave"
>
<view
wx:if="{{ title || useTitleSlot }}"
+16 -1
View File
@@ -44,6 +44,18 @@ var props_1 = require("./props");
innerValue: '',
showClear: false,
},
watch: {
value: function (value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
this.setShowClear();
}
},
clearTrigger: function () {
this.setShowClear();
},
},
created: function () {
this.value = this.data.value;
this.setData({ innerValue: this.value });
@@ -109,6 +121,9 @@ var props_1 = require("./props");
onKeyboardHeightChange: function (event) {
this.$emit('keyboardheightchange', event.detail);
},
onBindNicknameReview: function (event) {
this.$emit('nicknamereview', event.detail);
},
emitChange: function (detail) {
var extraEventParams = this.data.extraEventParams;
this.setData({ value: detail.value });
@@ -130,7 +145,7 @@ var props_1 = require("./props");
var trigger = clearTrigger === 'always' || (clearTrigger === 'focus' && focused);
showClear = hasValue && trigger;
}
this.setData({ showClear: showClear });
this.setView({ showClear: showClear });
},
noop: function () { },
},
@@ -27,4 +27,5 @@
bindfocus="onFocus"
bindconfirm="onConfirm"
bindkeyboardheightchange="onKeyboardHeightChange"
bindnicknamereview="onBindNicknameReview"
/>
+1 -9
View File
@@ -2,15 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.textareaProps = exports.inputProps = exports.commonProps = void 0;
exports.commonProps = {
value: {
type: String,
observer: function (value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
}
},
},
value: String,
placeholder: String,
placeholderStyle: String,
placeholderClass: String,
+1 -1
View File
@@ -1 +1 @@
@import '../common/index.wxss';.van-image{display:inline-block;position:relative}.van-image--round{border-radius:50%;overflow:hidden}.van-image--round .van-image__img{border-radius:inherit}.van-image__error,.van-image__img,.van-image__loading{display:block;height:100%;width:100%}.van-image__error,.van-image__loading{align-items:center;background-color:var(--image-placeholder-background-color,#f7f8fa);color:var(--image-placeholder-text-color,#969799);display:flex;flex-direction:column;font-size:var(--image-placeholder-font-size,14px);justify-content:center;left:0;position:absolute;top:0}.van-image__loading-icon{color:var(--image-loading-icon-color,#dcdee0);font-size:var(--image-loading-icon-size,32px)!important}.van-image__error-icon{color:var(--image-error-icon-color,#dcdee0);font-size:var(--image-error-icon-size,32px)!important}
@import '../common/index.wxss';.van-image{display:inline-block;position:relative;vertical-align:top}.van-image--round{border-radius:50%;overflow:hidden}.van-image--round .van-image__img{border-radius:inherit}.van-image__error,.van-image__img,.van-image__loading{display:block;height:100%;width:100%}.van-image__error,.van-image__loading{align-items:center;background-color:var(--image-placeholder-background-color,#f7f8fa);color:var(--image-placeholder-text-color,#969799);display:flex;flex-direction:column;font-size:var(--image-placeholder-font-size,14px);justify-content:center;left:0;position:absolute;top:0}.van-image__loading-icon{color:var(--image-loading-icon-color,#dcdee0);font-size:var(--image-loading-icon-size,32px)!important}.van-image__error-icon{color:var(--image-error-icon-color,#dcdee0);font-size:var(--image-error-icon-size,32px)!important}
@@ -10,5 +10,21 @@ exports.basic = Behavior({
this.setData(data);
return new Promise(function (resolve) { return wx.nextTick(resolve); });
},
// high performance setData
setView: function (data, callback) {
var _this = this;
var target = {};
var hasChange = false;
Object.keys(data).forEach(function (key) {
if (data[key] !== _this.data[key]) {
target[key] = data[key];
hasChange = true;
}
});
if (hasChange) {
return this.setData(target, callback);
}
return callback && callback();
},
},
});
@@ -24,7 +24,6 @@ function transition(showDefaultValue) {
duration: {
type: null,
value: 300,
observer: 'observeDuration',
},
name: {
type: String,
@@ -46,76 +45,85 @@ function transition(showDefaultValue) {
if (value === old) {
return;
}
value ? this.enter() : this.leave();
value ? this.enureEnter() : this.enureLeave();
},
enter: function () {
enureEnter: function () {
var _this = this;
if (this.enterFinishedPromise)
if (this.enterPromise)
return;
this.enterFinishedPromise = new Promise(function (resolve) {
var _a = _this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration;
if (_this.status === 'enter') {
this.enterPromise = new Promise(function (resolve) { return _this.enter(resolve); });
},
enureLeave: function () {
var _this = this;
var enterPromise = this.enterPromise;
if (!enterPromise)
return;
enterPromise
.then(function () { return new Promise(function (resolve) { return _this.leave(resolve); }); })
.then(function () {
_this.enterPromise = null;
});
},
enter: function (resolve) {
var _this = this;
var _a = this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration;
if (this.status === 'enter') {
return;
}
this.status = 'enter';
this.$emit('before-enter');
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'enter') {
return;
}
_this.status = 'enter';
_this.$emit('before-enter');
_this.$emit('enter');
_this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration: currentDuration,
});
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'enter') {
return;
}
_this.$emit('enter');
_this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration: currentDuration,
});
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'enter') {
return;
}
_this.transitionEnded = false;
_this.setData({ classes: classNames['enter-to'] });
resolve();
});
_this.transitionEnded = false;
_this.setData({ classes: classNames['enter-to'] });
resolve();
});
});
},
leave: function () {
leave: function (resolve) {
var _this = this;
if (!this.enterFinishedPromise)
if (!this.data.display) {
return;
this.enterFinishedPromise.then(function () {
if (!_this.data.display) {
}
var _a = this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.leave : duration;
this.status = 'leave';
this.$emit('before-leave');
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'leave') {
return;
}
var _a = _this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.leave : duration;
_this.status = 'leave';
_this.$emit('before-leave');
_this.$emit('leave');
_this.setData({
classes: classNames.leave,
currentDuration: currentDuration,
});
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'leave') {
return;
}
_this.$emit('leave');
_this.setData({
classes: classNames.leave,
currentDuration: currentDuration,
});
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'leave') {
return;
}
_this.transitionEnded = false;
setTimeout(function () {
_this.onTransitionEnd();
_this.enterFinishedPromise = null;
}, currentDuration);
_this.setData({ classes: classNames['leave-to'] });
});
_this.transitionEnded = false;
setTimeout(function () {
_this.onTransitionEnd();
resolve();
}, currentDuration);
_this.setData({ classes: classNames['leave-to'] });
});
});
},
+19 -12
View File
@@ -64,7 +64,7 @@ var utils_1 = require("../common/utils");
(0, utils_1.getRect)(_this, '.van-notice-bar__wrap'),
]).then(function (rects) {
var contentRect = rects[0], wrapRect = rects[1];
var _a = _this.data, speed = _a.speed, scrollable = _a.scrollable, delay = _a.delay;
var scrollable = _this.data.scrollable;
if (contentRect == null ||
wrapRect == null ||
!contentRect.width ||
@@ -73,20 +73,26 @@ var utils_1 = require("../common/utils");
return;
}
if (scrollable || wrapRect.width < contentRect.width) {
var duration = ((wrapRect.width + 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.initAnimation(wrapRect.width, contentRect.width);
_this.scroll(true);
}
});
});
},
initAnimation: function (warpWidth, contentWidth) {
var _a = this.data, speed = _a.speed, delay = _a.delay;
this.wrapWidth = warpWidth;
this.contentWidth = contentWidth;
// begin 0
this.contentDuration = (contentWidth / speed) * 1000;
// begin -wrapWidth
this.duration = ((warpWidth + contentWidth) / speed) * 1000;
this.animation = wx.createAnimation({
duration: this.contentDuration,
timingFunction: 'linear',
delay: delay,
});
},
scroll: function (isInit) {
var _this = this;
if (isInit === void 0) { isInit = false; }
@@ -98,17 +104,18 @@ var utils_1 = require("../common/utils");
.step()
.export(),
});
var duration = isInit ? this.contentDuration : this.duration;
(0, utils_1.requestAnimationFrame)(function () {
_this.setData({
animationData: _this.animation
.translateX(-_this.contentWidth)
.step()
.step({ duration: duration })
.export(),
});
});
this.timer = setTimeout(function () {
_this.scroll();
}, this.duration + this.data.delay);
}, duration + this.data.delay);
},
onClickIcon: function (event) {
if (this.data.mode === 'closeable') {
+23 -27
View File
@@ -85,18 +85,18 @@ function equal(value1, value2) {
},
created: function () {
this.setData({
currentValue: this.format(this.data.value),
currentValue: this.format(this.data.value).newValue,
});
},
methods: {
observeValue: function () {
var value = this.data.value;
this.setData({ currentValue: this.format(value) });
this.setData({ currentValue: this.format(value).newValue });
},
check: function () {
var val = this.format(this.data.currentValue);
if (!equal(val, this.data.currentValue)) {
this.setData({ currentValue: val });
var newValue = this.format(this.data.currentValue).newValue;
if (!equal(newValue, this.data.currentValue)) {
this.setData({ currentValue: newValue });
}
},
isDisabled: function (type) {
@@ -110,10 +110,10 @@ function equal(value1, value2) {
this.$emit('focus', event.detail);
},
onBlur: function (event) {
var value = this.format(event.detail.value);
this.setData({ currentValue: value });
this.emitChange(value);
this.$emit('blur', __assign(__assign({}, event.detail), { value: value }));
var data = this.format(event.detail.value);
this.setData({ currentValue: data.newValue });
this.emitChange(data);
this.$emit('blur', __assign(__assign({}, event.detail), { value: +data.newValue }));
},
// filter illegal characters
filter: function (value) {
@@ -123,17 +123,16 @@ function equal(value1, value2) {
}
return value;
},
// limit value range
format: function (value) {
value = this.filter(value);
// filter illegal characters and format integer
var safeValue = this.filter(value);
// format range
value = value === '' ? 0 : +value;
value = Math.max(Math.min(this.data.max, value), this.data.min);
var rangeValue = Math.max(Math.min(this.data.max, +safeValue), this.data.min);
// format decimal
if ((0, validator_1.isDef)(this.data.decimalLength)) {
value = value.toFixed(this.data.decimalLength);
}
return value;
var newValue = (0, validator_1.isDef)(this.data.decimalLength)
? rangeValue.toFixed(this.data.decimalLength)
: String(rangeValue);
return { value: value, newValue: newValue };
},
onInput: function (event) {
var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a;
@@ -141,19 +140,16 @@ function equal(value1, value2) {
if (value === '') {
return;
}
var formatted = this.filter(value);
// limit max decimal length
if ((0, validator_1.isDef)(this.data.decimalLength) && formatted.indexOf('.') !== -1) {
var pair = formatted.split('.');
formatted = "".concat(pair[0], ".").concat(pair[1].slice(0, this.data.decimalLength));
}
var formatted = this.format(value);
this.emitChange(formatted);
},
emitChange: function (value) {
emitChange: function (data) {
var value = data.value, newValue = data.newValue;
if (!this.data.asyncChange) {
this.setData({ currentValue: value });
// fix when input 11. parsed to 11, unable to enter decimal
this.setData({ currentValue: +value === +newValue ? value : newValue });
}
this.$emit('change', value);
this.$emit('change', +newValue);
},
onChange: function () {
var type = this.type;
@@ -162,7 +158,7 @@ function equal(value1, value2) {
return;
}
var diff = type === 'minus' ? -this.data.step : +this.data.step;
var value = this.format(add(+this.data.currentValue, diff));
var value = this.format(String(add(+this.data.currentValue, diff)));
this.emitChange(value);
this.$emit(type);
},
+1 -1
View File
@@ -1 +1 @@
@import '../common/index.wxss';.van-steps{background-color:var(--steps-background-color,#fff);overflow:hidden}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{display:flex;overflow:hidden;position:relative}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{color:var(--step-text-color,#969799);flex:1;font-size:var(--step-font-size,14px);position:relative}.van-step--finish{color:var(--step-finish-text-color,#323233)}.van-step__circle{background-color:var(--step-circle-color,#969799);border-radius:50%;height:var(--step-circle-size,5px);width:var(--step-circle-size,5px)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 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;transform:none}.van-step--horizontal:last-child .van-step__circle-container{padding:0 0 0 8px;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{background-color:#fff;bottom:6px;padding:0 var(--padding-xs,8px);position:absolute;transform:translate3d(-50%,50%,0);z-index:1}.van-step--horizontal .van-step__title{display:inline-block;font-size:var(--step-horizontal-title-font-size,12px);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{background-color:var(--step-line-color,#ebedf0);bottom:6px;height:1px;left:0;position:absolute;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical{line-height:18px;padding:10px 10px 10px 0}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{background-color:#fff;content:"";height:20px;left:-15px;position:absolute;top:0;width:1px;z-index:1}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{left:-14px;position:absolute;top:19px;transform:translate3d(-50%,-50%,0);z-index:2}.van-step--vertical .van-step__icon{background-color:var(--steps-background-color,#fff);font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical .van-step__line{background-color:var(--step-line-color,#ebedf0);height:100%;transform:translate3d(-50%,0,0);width:1px;z-index:1}
@import '../common/index.wxss';.van-steps{background-color:var(--steps-background-color,#fff);overflow:hidden}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{display:flex;overflow:hidden;position:relative}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{color:var(--step-text-color,#969799);flex:1;font-size:var(--step-font-size,14px);position:relative}.van-step--finish{color:var(--step-finish-text-color,#323233)}.van-step__circle{background-color:var(--step-circle-color,#969799);border-radius:50%;height:var(--step-circle-size,5px);width:var(--step-circle-size,5px)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 0;transform:translate3d(0,50%,0)}.van-step--horizontal:last-child{bottom:0;position:absolute;right:0;top:0;width:auto}.van-step--horizontal:last-child .van-step__title{text-align:right;transform:none}.van-step--horizontal:last-child .van-step__circle-container{padding:0 0 0 8px;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{background-color:#fff;bottom:6px;padding:0 var(--padding-xs,8px);position:absolute;transform:translate3d(-50%,50%,0);z-index:1}.van-step--horizontal .van-step__title{display:inline-block;font-size:var(--step-horizontal-title-font-size,12px);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{background-color:var(--step-line-color,#ebedf0);bottom:6px;height:1px;left:0;position:absolute;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical{line-height:18px;padding:10px 10px 10px 0}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{background-color:#fff;content:"";height:20px;left:-15px;position:absolute;top:0;width:1px;z-index:1}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{left:-14px;position:absolute;top:19px;transform:translate3d(-50%,-50%,0);z-index:2}.van-step--vertical .van-step__icon{background-color:var(--steps-background-color,#fff);font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical .van-step__line{background-color:var(--step-line-color,#ebedf0);height:100%;transform:translate3d(-50%,0,0);width:1px;z-index:1}
@@ -12,9 +12,9 @@ var __assign = (this && this.__assign) || function () {
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var utils_1 = require("./utils");
var shared_1 = require("./shared");
var validator_1 = require("../common/validator");
var shared_1 = require("./shared");
var utils_1 = require("./utils");
(0, component_1.VantComponent)({
props: __assign(__assign(__assign(__assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: {
type: null,
@@ -168,6 +168,8 @@ var validator_1 = require("../common/validator");
});
},
onPreviewFile: function (event) {
if (!this.data.previewFile)
return;
var index = event.currentTarget.dataset.index;
wx.openDocument({
filePath: this.data.lists[index].url,
@@ -29,6 +29,7 @@
poster="{{ item.thumb }}"
autoplay="{{ item.autoplay }}"
object-fit="{{videoFit}}"
referrer-policy="{{ referrerPolicy }}"
class="van-uploader__preview-image"
style="{{ computed.sizeStyle({ previewSize }) }}"
data-index="{{ index }}"
+8
View File
@@ -29,6 +29,10 @@ export declare const videoProps: {
type: StringConstructor;
value: string;
};
referrerPolicy: {
type: StringConstructor;
value: string;
};
};
export declare const mediaProps: {
capture: {
@@ -50,4 +54,8 @@ export declare const mediaProps: {
};
export declare const messageFileProps: {
extension: null;
previewFile: {
type: BooleanConstructor;
value: boolean;
};
};
@@ -34,6 +34,10 @@ exports.videoProps = {
type: String,
value: 'back',
},
referrerPolicy: {
type: String,
value: 'no-referrer',
},
};
// props for media
exports.mediaProps = {
@@ -57,4 +61,8 @@ exports.mediaProps = {
// props for file
exports.messageFileProps = {
extension: null,
previewFile: {
type: Boolean,
value: true,
},
};
+5 -4
View File
@@ -1,12 +1,13 @@
{
"name": "yelaymaths",
"name": "YelayMaths",
"lockfileVersion": 3,
"requires": true,
"packages": {
"node_modules/@vant/weapp": {
"version": "1.11.4",
"resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.11.4.tgz",
"integrity": "sha512-egOsWO4hVMP1SQSqQ46jy8UD3WysvlnUecRzPM21Y3ovkOFZ6wlaO7oHQmTXRpwr+V41Qri1qEbtNjhVxFqdyw=="
"version": "1.11.7",
"resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.11.7.tgz",
"integrity": "sha512-Rwn9BBnb4kHSV4XmvBicwtd42J+amEUfnFDcXJsGNPNX4a9c/DoT6YLsm4X1wB2+sQbdiQsbFBLAvGRBxCkD8g==",
"license": "MIT"
}
}
}
+7 -5
View File
@@ -11,9 +11,9 @@
</p>
<p align="center">
🔥 <a href="https://vant-contrib.gitee.io/vant-weapp">文档网站(国内)</a>
🔥 <a href="https://vant.pro/vant-weapp/">文档网站(国内)</a>
&nbsp;
🌈 <a href="https://youzan.github.io/vant-weapp">文档网站(GitHub</a>
🔥 <a href="https://vant-ui.github.io/vant-weapp/">文档网站(GitHub</a>
&nbsp;
🚀 <a href="https://github.com/vant-ui/vant" target="_blank">Vue 版</a>
</p>
@@ -24,7 +24,7 @@
Vant 是一个**轻量、可靠的移动端组件库**,于 2017 年开源。
目前 Vant 官方提供了 [Vue 2 版本](https://vant-contrib.gitee.io/vant/v2)、[Vue 3 版本](https://vant-contrib.gitee.io/vant)和[微信小程序版本](http://vant-contrib.gitee.io/vant-weapp),并由社区团队维护 [React 版本](https://github.com/3lang3/react-vant)和[支付宝小程序版本](https://github.com/ant-move/Vant-Aliapp)。
目前 Vant 官方提供了 [Vue 2 版本](https://vant-ui.github.io/vant/v2/)、[Vue 3 版本](https://vant-ui.github.io/vant/)和[微信小程序版本](http://vant-ui.github.io/vant-weapp/),并由社区团队维护 [React 版本](https://github.com/3lang3/react-vant)和[支付宝小程序版本](https://github.com/ant-move/Vant-Aliapp)。
## 预览
@@ -99,9 +99,11 @@ Vant Weapp 最低支持到小程序基础库 2.6.5 版本。
## 链接
- [文档网站(GitHub](https://vant-ui.github.io/vant-weapp/)
- [文档网站(国内)](https://vant.pro/vant-weapp/)
- [意见反馈](https://github.com/youzan/vant-weapp/issues)
- [设计资源](https://vant-contrib.gitee.io/vant/#/zh-CN/design)
- [更新日志](https://vant-contrib.gitee.io/vant-weapp/#/changelog)
- [设计资源](https://vant-ui.github.io/vant/#/zh-CN/design)
- [更新日志](https://vant-ui.github.io/vant-weapp/#/changelog)
- [官方示例](https://github.com/vant-ui/vant-demo)
## 核心团队
+5
View File
@@ -36,6 +36,10 @@ VantComponent({
type: Boolean,
value: true,
},
ellipsis: {
type: Boolean,
value: true,
},
showHeader: {
type: Boolean,
value: true,
@@ -148,6 +152,7 @@ VantComponent({
selected: null,
},
],
activeTab: 0,
});
},
onClose() {
+1
View File
@@ -19,6 +19,7 @@
color="{{ activeColor }}"
border="{{ false }}"
swipeable="{{ swipeable }}"
ellipsis="{{ ellipsis }}"
bind:click="onClickTab"
>
<van-tab
+3 -2
View File
@@ -24,6 +24,7 @@ VantComponent({
},
data: {
expanded: false,
parentBorder: true,
},
mounted() {
this.updateExpanded();
@@ -34,7 +35,7 @@ VantComponent({
if (!this.parent) {
return;
}
const { value, accordion } = this.parent.data;
const { value, accordion, border } = this.parent.data;
const { children = [] } = this.parent;
const { name } = this.data;
const index = children.indexOf(this);
@@ -45,7 +46,7 @@ VantComponent({
if (expanded !== this.data.expanded) {
setContentAnimate(this, expanded, this.mounted);
}
this.setData({ index, expanded });
this.setData({ index, expanded, parentBorder: border });
},
onClick() {
if (this.data.disabled) {
+1 -1
View File
@@ -1,6 +1,6 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="van-collapse-item custom-class {{ index !== 0 ? 'van-hairline--top' : '' }}">
<view class="van-collapse-item custom-class {{ index !== 0 && parentBorder ? 'van-hairline--top' : '' }}">
<van-cell
size="{{ size }}"
title="{{ title }}"
+1
View File
@@ -4,6 +4,7 @@ interface VantComponentInstance {
children: WechatMiniprogram.Component.TrivialInstance[];
index: number;
$emit: (name: string, detail?: unknown, options?: WechatMiniprogram.Component.TriggerEventOption) => void;
setView: (value: Record<string, any>, callback?: () => void) => void;
}
export type VantComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends WechatMiniprogram.Component.PropertyOption, Methods extends WechatMiniprogram.Component.MethodOption> = {
data?: Data;
+9 -7
View File
@@ -89,13 +89,15 @@ VantComponent({
},
close(action) {
this.setData({ show: false });
wx.nextTick(() => {
this.$emit('close', action);
const { callback } = this.data;
if (callback) {
callback(action, this);
}
});
this.closeAction = action;
},
onAfterLeave() {
const { closeAction: action } = this;
this.$emit('close', action);
const { callback } = this.data;
if (callback) {
callback(action, this);
}
},
stopLoading() {
this.setData({
+1
View File
@@ -11,6 +11,7 @@
close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay"
bind:after-leave="onAfterLeave"
>
<view
wx:if="{{ title || useTitleSlot }}"
+16 -1
View File
@@ -31,6 +31,18 @@ VantComponent({
innerValue: '',
showClear: false,
},
watch: {
value(value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
this.setShowClear();
}
},
clearTrigger() {
this.setShowClear();
},
},
created() {
this.value = this.data.value;
this.setData({ innerValue: this.value });
@@ -95,6 +107,9 @@ VantComponent({
onKeyboardHeightChange(event) {
this.$emit('keyboardheightchange', event.detail);
},
onBindNicknameReview(event) {
this.$emit('nicknamereview', event.detail);
},
emitChange(detail) {
const { extraEventParams } = this.data;
this.setData({ value: detail.value });
@@ -116,7 +131,7 @@ VantComponent({
const trigger = clearTrigger === 'always' || (clearTrigger === 'focus' && focused);
showClear = hasValue && trigger;
}
this.setData({ showClear });
this.setView({ showClear });
},
noop() { },
},
+1
View File
@@ -27,4 +27,5 @@
bindfocus="onFocus"
bindconfirm="onConfirm"
bindkeyboardheightchange="onKeyboardHeightChange"
bindnicknamereview="onBindNicknameReview"
/>
+1 -9
View File
@@ -1,13 +1,5 @@
export const commonProps = {
value: {
type: String,
observer(value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
}
},
},
value: String,
placeholder: String,
placeholderStyle: String,
placeholderClass: String,
+1 -1
View File
@@ -1 +1 @@
@import '../common/index.wxss';.van-image{display:inline-block;position:relative}.van-image--round{border-radius:50%;overflow:hidden}.van-image--round .van-image__img{border-radius:inherit}.van-image__error,.van-image__img,.van-image__loading{display:block;height:100%;width:100%}.van-image__error,.van-image__loading{align-items:center;background-color:var(--image-placeholder-background-color,#f7f8fa);color:var(--image-placeholder-text-color,#969799);display:flex;flex-direction:column;font-size:var(--image-placeholder-font-size,14px);justify-content:center;left:0;position:absolute;top:0}.van-image__loading-icon{color:var(--image-loading-icon-color,#dcdee0);font-size:var(--image-loading-icon-size,32px)!important}.van-image__error-icon{color:var(--image-error-icon-color,#dcdee0);font-size:var(--image-error-icon-size,32px)!important}
@import '../common/index.wxss';.van-image{display:inline-block;position:relative;vertical-align:top}.van-image--round{border-radius:50%;overflow:hidden}.van-image--round .van-image__img{border-radius:inherit}.van-image__error,.van-image__img,.van-image__loading{display:block;height:100%;width:100%}.van-image__error,.van-image__loading{align-items:center;background-color:var(--image-placeholder-background-color,#f7f8fa);color:var(--image-placeholder-text-color,#969799);display:flex;flex-direction:column;font-size:var(--image-placeholder-font-size,14px);justify-content:center;left:0;position:absolute;top:0}.van-image__loading-icon{color:var(--image-loading-icon-color,#dcdee0);font-size:var(--image-loading-icon-size,32px)!important}.van-image__error-icon{color:var(--image-error-icon-color,#dcdee0);font-size:var(--image-error-icon-size,32px)!important}
+15
View File
@@ -7,5 +7,20 @@ export const basic = Behavior({
this.setData(data);
return new Promise((resolve) => wx.nextTick(resolve));
},
// high performance setData
setView(data, callback) {
const target = {};
let hasChange = false;
Object.keys(data).forEach((key) => {
if (data[key] !== this.data[key]) {
target[key] = data[key];
hasChange = true;
}
});
if (hasChange) {
return this.setData(target, callback);
}
return callback && callback();
},
},
});
+57 -51
View File
@@ -21,7 +21,6 @@ export function transition(showDefaultValue) {
duration: {
type: null,
value: 300,
observer: 'observeDuration',
},
name: {
type: String,
@@ -43,74 +42,81 @@ export function transition(showDefaultValue) {
if (value === old) {
return;
}
value ? this.enter() : this.leave();
value ? this.enureEnter() : this.enureLeave();
},
enter() {
if (this.enterFinishedPromise)
enureEnter() {
if (this.enterPromise)
return;
this.enterFinishedPromise = new Promise((resolve) => {
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.enter : duration;
if (this.status === 'enter') {
this.enterPromise = new Promise((resolve) => this.enter(resolve));
},
enureLeave() {
const { enterPromise } = this;
if (!enterPromise)
return;
enterPromise
.then(() => new Promise((resolve) => this.leave(resolve)))
.then(() => {
this.enterPromise = null;
});
},
enter(resolve) {
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.enter : duration;
if (this.status === 'enter') {
return;
}
this.status = 'enter';
this.$emit('before-enter');
requestAnimationFrame(() => {
if (this.status !== 'enter') {
return;
}
this.status = 'enter';
this.$emit('before-enter');
this.$emit('enter');
this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration,
});
requestAnimationFrame(() => {
if (this.status !== 'enter') {
return;
}
this.$emit('enter');
this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration,
});
requestAnimationFrame(() => {
if (this.status !== 'enter') {
return;
}
this.transitionEnded = false;
this.setData({ classes: classNames['enter-to'] });
resolve();
});
this.transitionEnded = false;
this.setData({ classes: classNames['enter-to'] });
resolve();
});
});
},
leave() {
if (!this.enterFinishedPromise)
leave(resolve) {
if (!this.data.display) {
return;
this.enterFinishedPromise.then(() => {
if (!this.data.display) {
}
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.leave : duration;
this.status = 'leave';
this.$emit('before-leave');
requestAnimationFrame(() => {
if (this.status !== 'leave') {
return;
}
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.leave : duration;
this.status = 'leave';
this.$emit('before-leave');
this.$emit('leave');
this.setData({
classes: classNames.leave,
currentDuration,
});
requestAnimationFrame(() => {
if (this.status !== 'leave') {
return;
}
this.$emit('leave');
this.setData({
classes: classNames.leave,
currentDuration,
});
requestAnimationFrame(() => {
if (this.status !== 'leave') {
return;
}
this.transitionEnded = false;
setTimeout(() => {
this.onTransitionEnd();
this.enterFinishedPromise = null;
}, currentDuration);
this.setData({ classes: classNames['leave-to'] });
});
this.transitionEnded = false;
setTimeout(() => {
this.onTransitionEnd();
resolve();
}, currentDuration);
this.setData({ classes: classNames['leave-to'] });
});
});
},
+19 -12
View File
@@ -61,7 +61,7 @@ VantComponent({
getRect(this, '.van-notice-bar__wrap'),
]).then((rects) => {
const [contentRect, wrapRect] = rects;
const { speed, scrollable, delay } = this.data;
const { scrollable } = this.data;
if (contentRect == null ||
wrapRect == null ||
!contentRect.width ||
@@ -70,20 +70,26 @@ VantComponent({
return;
}
if (scrollable || wrapRect.width < contentRect.width) {
const duration = ((wrapRect.width + contentRect.width) / speed) * 1000;
this.wrapWidth = wrapRect.width;
this.contentWidth = contentRect.width;
this.duration = duration;
this.animation = wx.createAnimation({
duration,
timingFunction: 'linear',
delay,
});
this.initAnimation(wrapRect.width, contentRect.width);
this.scroll(true);
}
});
});
},
initAnimation(warpWidth, contentWidth) {
const { speed, delay } = this.data;
this.wrapWidth = warpWidth;
this.contentWidth = contentWidth;
// begin 0
this.contentDuration = (contentWidth / speed) * 1000;
// begin -wrapWidth
this.duration = ((warpWidth + contentWidth) / speed) * 1000;
this.animation = wx.createAnimation({
duration: this.contentDuration,
timingFunction: 'linear',
delay,
});
},
scroll(isInit = false) {
this.timer && clearTimeout(this.timer);
this.timer = null;
@@ -93,17 +99,18 @@ VantComponent({
.step()
.export(),
});
const duration = isInit ? this.contentDuration : this.duration;
requestAnimationFrame(() => {
this.setData({
animationData: this.animation
.translateX(-this.contentWidth)
.step()
.step({ duration })
.export(),
});
});
this.timer = setTimeout(() => {
this.scroll();
}, this.duration + this.data.delay);
}, duration + this.data.delay);
},
onClickIcon(event) {
if (this.data.mode === 'closeable') {
+23 -27
View File
@@ -72,18 +72,18 @@ VantComponent({
},
created() {
this.setData({
currentValue: this.format(this.data.value),
currentValue: this.format(this.data.value).newValue,
});
},
methods: {
observeValue() {
const { value } = this.data;
this.setData({ currentValue: this.format(value) });
this.setData({ currentValue: this.format(value).newValue });
},
check() {
const val = this.format(this.data.currentValue);
if (!equal(val, this.data.currentValue)) {
this.setData({ currentValue: val });
const { newValue } = this.format(this.data.currentValue);
if (!equal(newValue, this.data.currentValue)) {
this.setData({ currentValue: newValue });
}
},
isDisabled(type) {
@@ -97,10 +97,10 @@ VantComponent({
this.$emit('focus', event.detail);
},
onBlur(event) {
const value = this.format(event.detail.value);
this.setData({ currentValue: value });
this.emitChange(value);
this.$emit('blur', Object.assign(Object.assign({}, event.detail), { value }));
const data = this.format(event.detail.value);
this.setData({ currentValue: data.newValue });
this.emitChange(data);
this.$emit('blur', Object.assign(Object.assign({}, event.detail), { value: +data.newValue }));
},
// filter illegal characters
filter(value) {
@@ -110,17 +110,16 @@ VantComponent({
}
return value;
},
// limit value range
format(value) {
value = this.filter(value);
// filter illegal characters and format integer
const safeValue = this.filter(value);
// format range
value = value === '' ? 0 : +value;
value = Math.max(Math.min(this.data.max, value), this.data.min);
const rangeValue = Math.max(Math.min(this.data.max, +safeValue), this.data.min);
// format decimal
if (isDef(this.data.decimalLength)) {
value = value.toFixed(this.data.decimalLength);
}
return value;
const newValue = isDef(this.data.decimalLength)
? rangeValue.toFixed(this.data.decimalLength)
: String(rangeValue);
return { value, newValue };
},
onInput(event) {
const { value = '' } = event.detail || {};
@@ -128,19 +127,16 @@ VantComponent({
if (value === '') {
return;
}
let formatted = this.filter(value);
// limit max decimal length
if (isDef(this.data.decimalLength) && formatted.indexOf('.') !== -1) {
const pair = formatted.split('.');
formatted = `${pair[0]}.${pair[1].slice(0, this.data.decimalLength)}`;
}
const formatted = this.format(value);
this.emitChange(formatted);
},
emitChange(value) {
emitChange(data) {
const { value, newValue } = data;
if (!this.data.asyncChange) {
this.setData({ currentValue: value });
// fix when input 11. parsed to 11, unable to enter decimal
this.setData({ currentValue: +value === +newValue ? value : newValue });
}
this.$emit('change', value);
this.$emit('change', +newValue);
},
onChange() {
const { type } = this;
@@ -149,7 +145,7 @@ VantComponent({
return;
}
const diff = type === 'minus' ? -this.data.step : +this.data.step;
const value = this.format(add(+this.data.currentValue, diff));
const value = this.format(String(add(+this.data.currentValue, diff)));
this.emitChange(value);
this.$emit(type);
},
+1 -1
View File
@@ -1 +1 @@
@import '../common/index.wxss';.van-steps{background-color:var(--steps-background-color,#fff);overflow:hidden}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{display:flex;overflow:hidden;position:relative}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{color:var(--step-text-color,#969799);flex:1;font-size:var(--step-font-size,14px);position:relative}.van-step--finish{color:var(--step-finish-text-color,#323233)}.van-step__circle{background-color:var(--step-circle-color,#969799);border-radius:50%;height:var(--step-circle-size,5px);width:var(--step-circle-size,5px)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 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;transform:none}.van-step--horizontal:last-child .van-step__circle-container{padding:0 0 0 8px;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{background-color:#fff;bottom:6px;padding:0 var(--padding-xs,8px);position:absolute;transform:translate3d(-50%,50%,0);z-index:1}.van-step--horizontal .van-step__title{display:inline-block;font-size:var(--step-horizontal-title-font-size,12px);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{background-color:var(--step-line-color,#ebedf0);bottom:6px;height:1px;left:0;position:absolute;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical{line-height:18px;padding:10px 10px 10px 0}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{background-color:#fff;content:"";height:20px;left:-15px;position:absolute;top:0;width:1px;z-index:1}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{left:-14px;position:absolute;top:19px;transform:translate3d(-50%,-50%,0);z-index:2}.van-step--vertical .van-step__icon{background-color:var(--steps-background-color,#fff);font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical .van-step__line{background-color:var(--step-line-color,#ebedf0);height:100%;transform:translate3d(-50%,0,0);width:1px;z-index:1}
@import '../common/index.wxss';.van-steps{background-color:var(--steps-background-color,#fff);overflow:hidden}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{display:flex;overflow:hidden;position:relative}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{color:var(--step-text-color,#969799);flex:1;font-size:var(--step-font-size,14px);position:relative}.van-step--finish{color:var(--step-finish-text-color,#323233)}.van-step__circle{background-color:var(--step-circle-color,#969799);border-radius:50%;height:var(--step-circle-size,5px);width:var(--step-circle-size,5px)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 0;transform:translate3d(0,50%,0)}.van-step--horizontal:last-child{bottom:0;position:absolute;right:0;top:0;width:auto}.van-step--horizontal:last-child .van-step__title{text-align:right;transform:none}.van-step--horizontal:last-child .van-step__circle-container{padding:0 0 0 8px;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{background-color:#fff;bottom:6px;padding:0 var(--padding-xs,8px);position:absolute;transform:translate3d(-50%,50%,0);z-index:1}.van-step--horizontal .van-step__title{display:inline-block;font-size:var(--step-horizontal-title-font-size,12px);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{background-color:var(--step-line-color,#ebedf0);bottom:6px;height:1px;left:0;position:absolute;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical{line-height:18px;padding:10px 10px 10px 0}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{background-color:#fff;content:"";height:20px;left:-15px;position:absolute;top:0;width:1px;z-index:1}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{left:-14px;position:absolute;top:19px;transform:translate3d(-50%,-50%,0);z-index:2}.van-step--vertical .van-step__icon{background-color:var(--steps-background-color,#fff);font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical .van-step__line{background-color:var(--step-line-color,#ebedf0);height:100%;transform:translate3d(-50%,0,0);width:1px;z-index:1}
+4 -2
View File
@@ -1,7 +1,7 @@
import { VantComponent } from '../common/component';
import { isImageFile, chooseFile, isVideoFile } from './utils';
import { imageProps, videoProps, mediaProps, messageFileProps } from './shared';
import { isBoolean, isPromise } from '../common/validator';
import { imageProps, mediaProps, messageFileProps, videoProps } from './shared';
import { chooseFile, isImageFile, isVideoFile } from './utils';
VantComponent({
props: Object.assign(Object.assign(Object.assign(Object.assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: {
type: null,
@@ -153,6 +153,8 @@ VantComponent({
});
},
onPreviewFile(event) {
if (!this.data.previewFile)
return;
const { index } = event.currentTarget.dataset;
wx.openDocument({
filePath: this.data.lists[index].url,
+1
View File
@@ -29,6 +29,7 @@
poster="{{ item.thumb }}"
autoplay="{{ item.autoplay }}"
object-fit="{{videoFit}}"
referrer-policy="{{ referrerPolicy }}"
class="van-uploader__preview-image"
style="{{ computed.sizeStyle({ previewSize }) }}"
data-index="{{ index }}"
+8
View File
@@ -29,6 +29,10 @@ export declare const videoProps: {
type: StringConstructor;
value: string;
};
referrerPolicy: {
type: StringConstructor;
value: string;
};
};
export declare const mediaProps: {
capture: {
@@ -50,4 +54,8 @@ export declare const mediaProps: {
};
export declare const messageFileProps: {
extension: null;
previewFile: {
type: BooleanConstructor;
value: boolean;
};
};
+8
View File
@@ -31,6 +31,10 @@ export const videoProps = {
type: String,
value: 'back',
},
referrerPolicy: {
type: String,
value: 'no-referrer',
},
};
// props for media
export const mediaProps = {
@@ -54,4 +58,8 @@ export const mediaProps = {
// props for file
export const messageFileProps = {
extension: null,
previewFile: {
type: Boolean,
value: true,
},
};
+5
View File
@@ -47,6 +47,10 @@ var defaultFieldNames = {
type: Boolean,
value: true,
},
ellipsis: {
type: Boolean,
value: true,
},
showHeader: {
type: Boolean,
value: true,
@@ -161,6 +165,7 @@ var defaultFieldNames = {
selected: null,
},
],
activeTab: 0,
});
},
onClose: function () {
+1
View File
@@ -19,6 +19,7 @@
color="{{ activeColor }}"
border="{{ false }}"
swipeable="{{ swipeable }}"
ellipsis="{{ ellipsis }}"
bind:click="onClickTab"
>
<van-tab
+3 -2
View File
@@ -26,6 +26,7 @@ var animate_1 = require("./animate");
},
data: {
expanded: false,
parentBorder: true,
},
mounted: function () {
this.updateExpanded();
@@ -36,7 +37,7 @@ var animate_1 = require("./animate");
if (!this.parent) {
return;
}
var _a = this.parent.data, value = _a.value, accordion = _a.accordion;
var _a = this.parent.data, value = _a.value, accordion = _a.accordion, border = _a.border;
var _b = this.parent.children, children = _b === void 0 ? [] : _b;
var name = this.data.name;
var index = children.indexOf(this);
@@ -47,7 +48,7 @@ var animate_1 = require("./animate");
if (expanded !== this.data.expanded) {
(0, animate_1.setContentAnimate)(this, expanded, this.mounted);
}
this.setData({ index: index, expanded: expanded });
this.setData({ index: index, expanded: expanded, parentBorder: border });
},
onClick: function () {
if (this.data.disabled) {
+1 -1
View File
@@ -1,6 +1,6 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="van-collapse-item custom-class {{ index !== 0 ? 'van-hairline--top' : '' }}">
<view class="van-collapse-item custom-class {{ index !== 0 && parentBorder ? 'van-hairline--top' : '' }}">
<van-cell
size="{{ size }}"
title="{{ title }}"
+1
View File
@@ -4,6 +4,7 @@ interface VantComponentInstance {
children: WechatMiniprogram.Component.TrivialInstance[];
index: number;
$emit: (name: string, detail?: unknown, options?: WechatMiniprogram.Component.TriggerEventOption) => void;
setView: (value: Record<string, any>, callback?: () => void) => void;
}
export type VantComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends WechatMiniprogram.Component.PropertyOption, Methods extends WechatMiniprogram.Component.MethodOption> = {
data?: Data;
+9 -8
View File
@@ -90,15 +90,16 @@ var utils_1 = require("../common/utils");
this.close('overlay');
},
close: function (action) {
var _this = this;
this.setData({ show: false });
wx.nextTick(function () {
_this.$emit('close', action);
var callback = _this.data.callback;
if (callback) {
callback(action, _this);
}
});
this.closeAction = action;
},
onAfterLeave: function () {
var action = this.closeAction;
this.$emit('close', action);
var callback = this.data.callback;
if (callback) {
callback(action, this);
}
},
stopLoading: function () {
this.setData({
+1
View File
@@ -11,6 +11,7 @@
close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay"
bind:after-leave="onAfterLeave"
>
<view
wx:if="{{ title || useTitleSlot }}"
+16 -1
View File
@@ -44,6 +44,18 @@ var props_1 = require("./props");
innerValue: '',
showClear: false,
},
watch: {
value: function (value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
this.setShowClear();
}
},
clearTrigger: function () {
this.setShowClear();
},
},
created: function () {
this.value = this.data.value;
this.setData({ innerValue: this.value });
@@ -109,6 +121,9 @@ var props_1 = require("./props");
onKeyboardHeightChange: function (event) {
this.$emit('keyboardheightchange', event.detail);
},
onBindNicknameReview: function (event) {
this.$emit('nicknamereview', event.detail);
},
emitChange: function (detail) {
var extraEventParams = this.data.extraEventParams;
this.setData({ value: detail.value });
@@ -130,7 +145,7 @@ var props_1 = require("./props");
var trigger = clearTrigger === 'always' || (clearTrigger === 'focus' && focused);
showClear = hasValue && trigger;
}
this.setData({ showClear: showClear });
this.setView({ showClear: showClear });
},
noop: function () { },
},
+1
View File
@@ -27,4 +27,5 @@
bindfocus="onFocus"
bindconfirm="onConfirm"
bindkeyboardheightchange="onKeyboardHeightChange"
bindnicknamereview="onBindNicknameReview"
/>
+1 -9
View File
@@ -2,15 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.textareaProps = exports.inputProps = exports.commonProps = void 0;
exports.commonProps = {
value: {
type: String,
observer: function (value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
}
},
},
value: String,
placeholder: String,
placeholderStyle: String,
placeholderClass: String,
+1 -1
View File
@@ -1 +1 @@
@import '../common/index.wxss';.van-image{display:inline-block;position:relative}.van-image--round{border-radius:50%;overflow:hidden}.van-image--round .van-image__img{border-radius:inherit}.van-image__error,.van-image__img,.van-image__loading{display:block;height:100%;width:100%}.van-image__error,.van-image__loading{align-items:center;background-color:var(--image-placeholder-background-color,#f7f8fa);color:var(--image-placeholder-text-color,#969799);display:flex;flex-direction:column;font-size:var(--image-placeholder-font-size,14px);justify-content:center;left:0;position:absolute;top:0}.van-image__loading-icon{color:var(--image-loading-icon-color,#dcdee0);font-size:var(--image-loading-icon-size,32px)!important}.van-image__error-icon{color:var(--image-error-icon-color,#dcdee0);font-size:var(--image-error-icon-size,32px)!important}
@import '../common/index.wxss';.van-image{display:inline-block;position:relative;vertical-align:top}.van-image--round{border-radius:50%;overflow:hidden}.van-image--round .van-image__img{border-radius:inherit}.van-image__error,.van-image__img,.van-image__loading{display:block;height:100%;width:100%}.van-image__error,.van-image__loading{align-items:center;background-color:var(--image-placeholder-background-color,#f7f8fa);color:var(--image-placeholder-text-color,#969799);display:flex;flex-direction:column;font-size:var(--image-placeholder-font-size,14px);justify-content:center;left:0;position:absolute;top:0}.van-image__loading-icon{color:var(--image-loading-icon-color,#dcdee0);font-size:var(--image-loading-icon-size,32px)!important}.van-image__error-icon{color:var(--image-error-icon-color,#dcdee0);font-size:var(--image-error-icon-size,32px)!important}
+16
View File
@@ -10,5 +10,21 @@ exports.basic = Behavior({
this.setData(data);
return new Promise(function (resolve) { return wx.nextTick(resolve); });
},
// high performance setData
setView: function (data, callback) {
var _this = this;
var target = {};
var hasChange = false;
Object.keys(data).forEach(function (key) {
if (data[key] !== _this.data[key]) {
target[key] = data[key];
hasChange = true;
}
});
if (hasChange) {
return this.setData(target, callback);
}
return callback && callback();
},
},
});
+59 -51
View File
@@ -24,7 +24,6 @@ function transition(showDefaultValue) {
duration: {
type: null,
value: 300,
observer: 'observeDuration',
},
name: {
type: String,
@@ -46,76 +45,85 @@ function transition(showDefaultValue) {
if (value === old) {
return;
}
value ? this.enter() : this.leave();
value ? this.enureEnter() : this.enureLeave();
},
enter: function () {
enureEnter: function () {
var _this = this;
if (this.enterFinishedPromise)
if (this.enterPromise)
return;
this.enterFinishedPromise = new Promise(function (resolve) {
var _a = _this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration;
if (_this.status === 'enter') {
this.enterPromise = new Promise(function (resolve) { return _this.enter(resolve); });
},
enureLeave: function () {
var _this = this;
var enterPromise = this.enterPromise;
if (!enterPromise)
return;
enterPromise
.then(function () { return new Promise(function (resolve) { return _this.leave(resolve); }); })
.then(function () {
_this.enterPromise = null;
});
},
enter: function (resolve) {
var _this = this;
var _a = this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration;
if (this.status === 'enter') {
return;
}
this.status = 'enter';
this.$emit('before-enter');
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'enter') {
return;
}
_this.status = 'enter';
_this.$emit('before-enter');
_this.$emit('enter');
_this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration: currentDuration,
});
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'enter') {
return;
}
_this.$emit('enter');
_this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration: currentDuration,
});
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'enter') {
return;
}
_this.transitionEnded = false;
_this.setData({ classes: classNames['enter-to'] });
resolve();
});
_this.transitionEnded = false;
_this.setData({ classes: classNames['enter-to'] });
resolve();
});
});
},
leave: function () {
leave: function (resolve) {
var _this = this;
if (!this.enterFinishedPromise)
if (!this.data.display) {
return;
this.enterFinishedPromise.then(function () {
if (!_this.data.display) {
}
var _a = this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.leave : duration;
this.status = 'leave';
this.$emit('before-leave');
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'leave') {
return;
}
var _a = _this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.leave : duration;
_this.status = 'leave';
_this.$emit('before-leave');
_this.$emit('leave');
_this.setData({
classes: classNames.leave,
currentDuration: currentDuration,
});
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'leave') {
return;
}
_this.$emit('leave');
_this.setData({
classes: classNames.leave,
currentDuration: currentDuration,
});
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'leave') {
return;
}
_this.transitionEnded = false;
setTimeout(function () {
_this.onTransitionEnd();
_this.enterFinishedPromise = null;
}, currentDuration);
_this.setData({ classes: classNames['leave-to'] });
});
_this.transitionEnded = false;
setTimeout(function () {
_this.onTransitionEnd();
resolve();
}, currentDuration);
_this.setData({ classes: classNames['leave-to'] });
});
});
},
+19 -12
View File
@@ -64,7 +64,7 @@ var utils_1 = require("../common/utils");
(0, utils_1.getRect)(_this, '.van-notice-bar__wrap'),
]).then(function (rects) {
var contentRect = rects[0], wrapRect = rects[1];
var _a = _this.data, speed = _a.speed, scrollable = _a.scrollable, delay = _a.delay;
var scrollable = _this.data.scrollable;
if (contentRect == null ||
wrapRect == null ||
!contentRect.width ||
@@ -73,20 +73,26 @@ var utils_1 = require("../common/utils");
return;
}
if (scrollable || wrapRect.width < contentRect.width) {
var duration = ((wrapRect.width + 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.initAnimation(wrapRect.width, contentRect.width);
_this.scroll(true);
}
});
});
},
initAnimation: function (warpWidth, contentWidth) {
var _a = this.data, speed = _a.speed, delay = _a.delay;
this.wrapWidth = warpWidth;
this.contentWidth = contentWidth;
// begin 0
this.contentDuration = (contentWidth / speed) * 1000;
// begin -wrapWidth
this.duration = ((warpWidth + contentWidth) / speed) * 1000;
this.animation = wx.createAnimation({
duration: this.contentDuration,
timingFunction: 'linear',
delay: delay,
});
},
scroll: function (isInit) {
var _this = this;
if (isInit === void 0) { isInit = false; }
@@ -98,17 +104,18 @@ var utils_1 = require("../common/utils");
.step()
.export(),
});
var duration = isInit ? this.contentDuration : this.duration;
(0, utils_1.requestAnimationFrame)(function () {
_this.setData({
animationData: _this.animation
.translateX(-_this.contentWidth)
.step()
.step({ duration: duration })
.export(),
});
});
this.timer = setTimeout(function () {
_this.scroll();
}, this.duration + this.data.delay);
}, duration + this.data.delay);
},
onClickIcon: function (event) {
if (this.data.mode === 'closeable') {
+23 -27
View File
@@ -85,18 +85,18 @@ function equal(value1, value2) {
},
created: function () {
this.setData({
currentValue: this.format(this.data.value),
currentValue: this.format(this.data.value).newValue,
});
},
methods: {
observeValue: function () {
var value = this.data.value;
this.setData({ currentValue: this.format(value) });
this.setData({ currentValue: this.format(value).newValue });
},
check: function () {
var val = this.format(this.data.currentValue);
if (!equal(val, this.data.currentValue)) {
this.setData({ currentValue: val });
var newValue = this.format(this.data.currentValue).newValue;
if (!equal(newValue, this.data.currentValue)) {
this.setData({ currentValue: newValue });
}
},
isDisabled: function (type) {
@@ -110,10 +110,10 @@ function equal(value1, value2) {
this.$emit('focus', event.detail);
},
onBlur: function (event) {
var value = this.format(event.detail.value);
this.setData({ currentValue: value });
this.emitChange(value);
this.$emit('blur', __assign(__assign({}, event.detail), { value: value }));
var data = this.format(event.detail.value);
this.setData({ currentValue: data.newValue });
this.emitChange(data);
this.$emit('blur', __assign(__assign({}, event.detail), { value: +data.newValue }));
},
// filter illegal characters
filter: function (value) {
@@ -123,17 +123,16 @@ function equal(value1, value2) {
}
return value;
},
// limit value range
format: function (value) {
value = this.filter(value);
// filter illegal characters and format integer
var safeValue = this.filter(value);
// format range
value = value === '' ? 0 : +value;
value = Math.max(Math.min(this.data.max, value), this.data.min);
var rangeValue = Math.max(Math.min(this.data.max, +safeValue), this.data.min);
// format decimal
if ((0, validator_1.isDef)(this.data.decimalLength)) {
value = value.toFixed(this.data.decimalLength);
}
return value;
var newValue = (0, validator_1.isDef)(this.data.decimalLength)
? rangeValue.toFixed(this.data.decimalLength)
: String(rangeValue);
return { value: value, newValue: newValue };
},
onInput: function (event) {
var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a;
@@ -141,19 +140,16 @@ function equal(value1, value2) {
if (value === '') {
return;
}
var formatted = this.filter(value);
// limit max decimal length
if ((0, validator_1.isDef)(this.data.decimalLength) && formatted.indexOf('.') !== -1) {
var pair = formatted.split('.');
formatted = "".concat(pair[0], ".").concat(pair[1].slice(0, this.data.decimalLength));
}
var formatted = this.format(value);
this.emitChange(formatted);
},
emitChange: function (value) {
emitChange: function (data) {
var value = data.value, newValue = data.newValue;
if (!this.data.asyncChange) {
this.setData({ currentValue: value });
// fix when input 11. parsed to 11, unable to enter decimal
this.setData({ currentValue: +value === +newValue ? value : newValue });
}
this.$emit('change', value);
this.$emit('change', +newValue);
},
onChange: function () {
var type = this.type;
@@ -162,7 +158,7 @@ function equal(value1, value2) {
return;
}
var diff = type === 'minus' ? -this.data.step : +this.data.step;
var value = this.format(add(+this.data.currentValue, diff));
var value = this.format(String(add(+this.data.currentValue, diff)));
this.emitChange(value);
this.$emit(type);
},
+1 -1
View File
@@ -1 +1 @@
@import '../common/index.wxss';.van-steps{background-color:var(--steps-background-color,#fff);overflow:hidden}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{display:flex;overflow:hidden;position:relative}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{color:var(--step-text-color,#969799);flex:1;font-size:var(--step-font-size,14px);position:relative}.van-step--finish{color:var(--step-finish-text-color,#323233)}.van-step__circle{background-color:var(--step-circle-color,#969799);border-radius:50%;height:var(--step-circle-size,5px);width:var(--step-circle-size,5px)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 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;transform:none}.van-step--horizontal:last-child .van-step__circle-container{padding:0 0 0 8px;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{background-color:#fff;bottom:6px;padding:0 var(--padding-xs,8px);position:absolute;transform:translate3d(-50%,50%,0);z-index:1}.van-step--horizontal .van-step__title{display:inline-block;font-size:var(--step-horizontal-title-font-size,12px);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{background-color:var(--step-line-color,#ebedf0);bottom:6px;height:1px;left:0;position:absolute;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical{line-height:18px;padding:10px 10px 10px 0}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{background-color:#fff;content:"";height:20px;left:-15px;position:absolute;top:0;width:1px;z-index:1}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{left:-14px;position:absolute;top:19px;transform:translate3d(-50%,-50%,0);z-index:2}.van-step--vertical .van-step__icon{background-color:var(--steps-background-color,#fff);font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical .van-step__line{background-color:var(--step-line-color,#ebedf0);height:100%;transform:translate3d(-50%,0,0);width:1px;z-index:1}
@import '../common/index.wxss';.van-steps{background-color:var(--steps-background-color,#fff);overflow:hidden}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{display:flex;overflow:hidden;position:relative}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{color:var(--step-text-color,#969799);flex:1;font-size:var(--step-font-size,14px);position:relative}.van-step--finish{color:var(--step-finish-text-color,#323233)}.van-step__circle{background-color:var(--step-circle-color,#969799);border-radius:50%;height:var(--step-circle-size,5px);width:var(--step-circle-size,5px)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 0;transform:translate3d(0,50%,0)}.van-step--horizontal:last-child{bottom:0;position:absolute;right:0;top:0;width:auto}.van-step--horizontal:last-child .van-step__title{text-align:right;transform:none}.van-step--horizontal:last-child .van-step__circle-container{padding:0 0 0 8px;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{background-color:#fff;bottom:6px;padding:0 var(--padding-xs,8px);position:absolute;transform:translate3d(-50%,50%,0);z-index:1}.van-step--horizontal .van-step__title{display:inline-block;font-size:var(--step-horizontal-title-font-size,12px);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{background-color:var(--step-line-color,#ebedf0);bottom:6px;height:1px;left:0;position:absolute;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical{line-height:18px;padding:10px 10px 10px 0}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{background-color:#fff;content:"";height:20px;left:-15px;position:absolute;top:0;width:1px;z-index:1}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{left:-14px;position:absolute;top:19px;transform:translate3d(-50%,-50%,0);z-index:2}.van-step--vertical .van-step__icon{background-color:var(--steps-background-color,#fff);font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical .van-step__line{background-color:var(--step-line-color,#ebedf0);height:100%;transform:translate3d(-50%,0,0);width:1px;z-index:1}
+4 -2
View File
@@ -12,9 +12,9 @@ var __assign = (this && this.__assign) || function () {
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var utils_1 = require("./utils");
var shared_1 = require("./shared");
var validator_1 = require("../common/validator");
var shared_1 = require("./shared");
var utils_1 = require("./utils");
(0, component_1.VantComponent)({
props: __assign(__assign(__assign(__assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: {
type: null,
@@ -168,6 +168,8 @@ var validator_1 = require("../common/validator");
});
},
onPreviewFile: function (event) {
if (!this.data.previewFile)
return;
var index = event.currentTarget.dataset.index;
wx.openDocument({
filePath: this.data.lists[index].url,
+1
View File
@@ -29,6 +29,7 @@
poster="{{ item.thumb }}"
autoplay="{{ item.autoplay }}"
object-fit="{{videoFit}}"
referrer-policy="{{ referrerPolicy }}"
class="van-uploader__preview-image"
style="{{ computed.sizeStyle({ previewSize }) }}"
data-index="{{ index }}"
+8
View File
@@ -29,6 +29,10 @@ export declare const videoProps: {
type: StringConstructor;
value: string;
};
referrerPolicy: {
type: StringConstructor;
value: string;
};
};
export declare const mediaProps: {
capture: {
@@ -50,4 +54,8 @@ export declare const mediaProps: {
};
export declare const messageFileProps: {
extension: null;
previewFile: {
type: BooleanConstructor;
value: boolean;
};
};
+8
View File
@@ -34,6 +34,10 @@ exports.videoProps = {
type: String,
value: 'back',
},
referrerPolicy: {
type: String,
value: 'no-referrer',
},
};
// props for media
exports.mediaProps = {
@@ -57,4 +61,8 @@ exports.mediaProps = {
// props for file
exports.messageFileProps = {
extension: null,
previewFile: {
type: Boolean,
value: true,
},
};
+8 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@vant/weapp",
"version": "1.11.4",
"version": "1.11.7",
"author": "vant-ui",
"license": "MIT",
"miniprogram": "lib",
@@ -16,7 +16,6 @@
"release": "sh build/release.sh",
"release:site": "vant-cli build-site && gh-pages -d site-dist --add",
"build:lib": "yarn && npx gulp -f build/compiler.js --series buildEs buildLib",
"build:changelog": "vant-cli changelog",
"upload:weapp": "node build/upload.js",
"test": "jest",
"test:watch": "jest --watch"
@@ -44,8 +43,9 @@
"@babel/plugin-transform-modules-commonjs": "^7.16.0",
"@babel/preset-typescript": "^7.16.0",
"@types/jest": "^27.0.2",
"@vant/cli": "^4.0.0",
"@vant/cli": "^7.0.3",
"@vant/icons": "^3.0.1",
"@vant/stylelint-config": "^1.4.2",
"gulp": "^4.0.2",
"gulp-insert": "^0.5.0",
"gulp-less": "^5.0.0",
@@ -58,6 +58,7 @@
"miniprogram-api-typings": "^3.1.6",
"miniprogram-ci": "^1.6.1",
"miniprogram-simulate": "^1.4.2",
"stylelint": "13.13.1",
"ts-jest": "^27.0.7",
"tscpaths": "^0.0.9",
"typescript": "^4.4.4",
@@ -67,5 +68,8 @@
"Chrome >= 53",
"ChromeAndroid >= 53",
"iOS >= 9"
]
],
"resolutions": {
"source-map": "0.7.4"
}
}
+6 -5
View File
@@ -1,17 +1,18 @@
{
"name": "yelaymaths",
"name": "YelayMaths",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"@vant/weapp": "^1.11.4"
"@vant/weapp": "^1.11.7"
}
},
"node_modules/@vant/weapp": {
"version": "1.11.4",
"resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.11.4.tgz",
"integrity": "sha512-egOsWO4hVMP1SQSqQ46jy8UD3WysvlnUecRzPM21Y3ovkOFZ6wlaO7oHQmTXRpwr+V41Qri1qEbtNjhVxFqdyw=="
"version": "1.11.7",
"resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.11.7.tgz",
"integrity": "sha512-Rwn9BBnb4kHSV4XmvBicwtd42J+amEUfnFDcXJsGNPNX4a9c/DoT6YLsm4X1wB2+sQbdiQsbFBLAvGRBxCkD8g==",
"license": "MIT"
}
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
{
"dependencies": {
"@vant/weapp": "^1.11.4"
"@vant/weapp": "^1.11.7"
}
}