build: compile 1.11.6

This commit is contained in:
landluck 2024-05-14 20:46:42 +08:00
parent 22f39e86b9
commit e5f462263b
19 changed files with 86 additions and 25 deletions

View File

@ -148,6 +148,7 @@ VantComponent({
selected: null,
},
],
activeTab: 0,
});
},
onClose() {

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;

14
dist/field/index.js vendored
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 });
@ -119,7 +131,7 @@ VantComponent({
const trigger = clearTrigger === 'always' || (clearTrigger === 'focus' && focused);
showClear = hasValue && trigger;
}
this.setData({ showClear });
this.setView({ showClear });
},
noop() { },
},

10
dist/field/props.js vendored
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,

15
dist/mixins/basic.js vendored
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();
},
},
});

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,

View File

@ -29,6 +29,7 @@
poster="{{ item.thumb }}"
autoplay="{{ item.autoplay }}"
object-fit="{{videoFit}}"
referrer-policy="{{videoReferrerPolicy}}"
class="van-uploader__preview-image"
style="{{ computed.sizeStyle({ previewSize }) }}"
data-index="{{ index }}"

View File

@ -29,6 +29,10 @@ export declare const videoProps: {
type: StringConstructor;
value: string;
};
referrerPolicy: {
type: StringConstructor;
value: string;
};
};
export declare const mediaProps: {
capture: {

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 = {

View File

@ -42,7 +42,7 @@
"condition": false
},
"compileType": "miniprogram",
"libVersion": "2.6.5",
"libVersion": "2.27.3",
"appid": "wx1c01b35002d3ba14",
"projectname": "vant-weapp",
"condition": {

View File

@ -161,6 +161,7 @@ var defaultFieldNames = {
selected: null,
},
],
activeTab: 0,
});
},
onClose: function () {

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;

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 });
@ -133,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 () { },
},

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,

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();
},
},
});

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,

View File

@ -29,6 +29,7 @@
poster="{{ item.thumb }}"
autoplay="{{ item.autoplay }}"
object-fit="{{videoFit}}"
referrer-policy="{{videoReferrerPolicy}}"
class="van-uploader__preview-image"
style="{{ computed.sizeStyle({ previewSize }) }}"
data-index="{{ index }}"

View File

@ -29,6 +29,10 @@ export declare const videoProps: {
type: StringConstructor;
value: string;
};
referrerPolicy: {
type: StringConstructor;
value: string;
};
};
export declare const mediaProps: {
capture: {

View File

@ -34,6 +34,10 @@ exports.videoProps = {
type: String,
value: 'back',
},
referrerPolicy: {
type: String,
value: 'no-referrer',
},
};
// props for media
exports.mediaProps = {