diff --git a/dist/button/index.js b/dist/button/index.js index 9571e6b9..2dd7c883 100644 --- a/dist/button/index.js +++ b/dist/button/index.js @@ -1,13 +1,19 @@ import { VantComponent } from '../common/component'; import { button } from '../mixins/button'; import { openType } from '../mixins/open-type'; +import { canIUseFormFieldButton } from '../common/version'; +const mixins = [button, openType]; +if (canIUseFormFieldButton()) { + mixins.push('wx://form-field-button'); +} VantComponent({ - mixins: [button, openType], + mixins, classes: ['hover-class', 'loading-class'], data: { baseStyle: '', }, props: { + formType: String, icon: String, classPrefix: { type: String, diff --git a/dist/button/index.wxml b/dist/button/index.wxml index 30abac96..ab393e8f 100644 --- a/dist/button/index.wxml +++ b/dist/button/index.wxml @@ -6,6 +6,7 @@ class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}" hover-class="van-button--active hover-class" lang="{{ lang }}" + form-type="{{ formType }}" style="{{ baseStyle }} {{ customStyle }}" open-type="{{ disabled ? '' : openType }}" business-id="{{ businessId }}" diff --git a/dist/calendar/index.js b/dist/calendar/index.js index 447fc7a1..47117cbf 100644 --- a/dist/calendar/index.js +++ b/dist/calendar/index.js @@ -276,7 +276,10 @@ VantComponent({ return true; }, onConfirm() { - if (this.data.type === 'range' && !this.checkRange()) { + if ( + this.data.type === 'range' && + !this.checkRange(this.data.currentDate) + ) { return; } wx.nextTick(() => { diff --git a/dist/circle/canvas.d.ts b/dist/circle/canvas.d.ts new file mode 100644 index 00000000..2ba9531d --- /dev/null +++ b/dist/circle/canvas.d.ts @@ -0,0 +1,6 @@ +/// +declare type CanvasContext = WechatMiniprogram.CanvasContext; +export declare function adaptor( + ctx: CanvasRenderingContext2D +): CanvasContext & CanvasRenderingContext2D; +export {}; diff --git a/dist/circle/canvas.js b/dist/circle/canvas.js new file mode 100644 index 00000000..c311335e --- /dev/null +++ b/dist/circle/canvas.js @@ -0,0 +1,43 @@ +export function adaptor(ctx) { + // @ts-ignore + return Object.assign(ctx, { + setStrokeStyle(val) { + ctx.strokeStyle = val; + }, + setLineWidth(val) { + ctx.lineWidth = val; + }, + setLineCap(val) { + ctx.lineCap = val; + }, + setFillStyle(val) { + ctx.fillStyle = val; + }, + setFontSize(val) { + ctx.font = String(val); + }, + setGlobalAlpha(val) { + ctx.globalAlpha = val; + }, + setLineJoin(val) { + ctx.lineJoin = val; + }, + setTextAlign(val) { + ctx.textAlign = val; + }, + setMiterLimit(val) { + ctx.miterLimit = val; + }, + setShadow(offsetX, offsetY, blur, color) { + ctx.shadowOffsetX = offsetX; + ctx.shadowOffsetY = offsetY; + ctx.shadowBlur = blur; + ctx.shadowColor = color; + }, + setTextBaseline(val) { + ctx.textBaseline = val; + }, + createCircularGradient() {}, + draw() {}, + }); +} diff --git a/dist/circle/index.js b/dist/circle/index.js index 6f04c71e..c11fcf08 100644 --- a/dist/circle/index.js +++ b/dist/circle/index.js @@ -1,6 +1,7 @@ import { VantComponent } from '../common/component'; import { isObj } from '../common/utils'; import { BLUE, WHITE } from '../common/color'; +import { adaptor } from './canvas'; function format(rate) { return Math.min(Math.max(rate, 0), 100); } @@ -26,6 +27,9 @@ VantComponent({ size: { type: Number, value: 100, + observer() { + this.drawCircle(this.currentValue); + }, }, fill: String, layerColor: { @@ -55,28 +59,45 @@ VantComponent({ }, methods: { getContext() { - if (!this.ctx) { - this.ctx = wx.createCanvasContext('van-circle', this); + const { type } = this.data; + if (type === '') { + const ctx = wx.createCanvasContext('van-circle', this); + return Promise.resolve(ctx); } - return this.ctx; + const dpr = wx.getSystemInfoSync().pixelRatio; + return new Promise((resolve) => { + wx.createSelectorQuery() + .in(this) + .select('#van-circle') + .fields({ node: true, size: true }) + .exec((res) => { + const canvas = res[0].node; + const ctx = canvas.getContext(type); + canvas.width = res[0].width * dpr; + canvas.height = res[0].height * dpr; + ctx.scale(dpr, dpr); + resolve(adaptor(ctx)); + }); + }); }, setHoverColor() { - const { color, size, type } = this.data; - const context = type ? this.getContext(type) : this.getContext(); + const { color, size } = this.data; let hoverColor = color; - if (isObj(color)) { - const LinearColor = context.createLinearGradient(size, 0, 0, 0); - Object.keys(color) - .sort((a, b) => parseFloat(a) - parseFloat(b)) - .map((key) => - LinearColor.addColorStop(parseFloat(key) / 100, color[key]) - ); - hoverColor = LinearColor; - } - this.setData({ hoverColor }); + this.getContext().then((context) => { + if (isObj(color)) { + const LinearColor = context.createLinearGradient(size, 0, 0, 0); + Object.keys(color) + .sort((a, b) => parseFloat(a) - parseFloat(b)) + .map((key) => + LinearColor.addColorStop(parseFloat(key) / 100, color[key]) + ); + hoverColor = LinearColor; + } + this.setData({ hoverColor }); + }); }, presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) { - const { strokeWidth, lineCap, clockwise, size } = this.data; + const { strokeWidth, lineCap, clockwise, size, type } = this.data; const position = size / 2; const radius = position - strokeWidth / 2; context.setStrokeStyle(strokeStyle); @@ -104,15 +125,16 @@ VantComponent({ this.presetCanvas(context, hoverColor, BEGIN_ANGLE, endAngle); }, drawCircle(currentValue) { - const { size, type } = this.data; - const context = type ? this.getContext(type) : this.getContext(); - context.clearRect(0, 0, size, size); - this.renderLayerCircle(context); - const formatValue = format(currentValue); - if (formatValue !== 0) { - this.renderHoverCircle(context, formatValue); - } - context.draw(); + const { size } = this.data; + this.getContext().then((context) => { + context.clearRect(0, 0, size, size); + this.renderLayerCircle(context); + const formatValue = format(currentValue); + if (formatValue !== 0) { + this.renderHoverCircle(context, formatValue); + } + context.draw(); + }); }, reRender() { // tofector 动画暂时没有想到好的解决方案 @@ -149,7 +171,6 @@ VantComponent({ this.drawCircle(value); }, destroyed() { - this.ctx = null; this.clearInterval(); }, }); diff --git a/dist/circle/index.wxml b/dist/circle/index.wxml index 607fc9d5..52bc59fc 100644 --- a/dist/circle/index.wxml +++ b/dist/circle/index.wxml @@ -1,9 +1,9 @@ - + {{ text }} - \ No newline at end of file + diff --git a/dist/common/version.d.ts b/dist/common/version.d.ts index f69a9f61..d4c6fe24 100644 --- a/dist/common/version.d.ts +++ b/dist/common/version.d.ts @@ -1 +1,2 @@ export declare function canIUseModel(): boolean; +export declare function canIUseFormFieldButton(): boolean; diff --git a/dist/common/version.js b/dist/common/version.js index a4f69619..01f24f88 100644 --- a/dist/common/version.js +++ b/dist/common/version.js @@ -25,3 +25,7 @@ export function canIUseModel() { const system = getSystemInfoSync(); return compareVersion(system.SDKVersion, '2.9.3') >= 0; } +export function canIUseFormFieldButton() { + const system = getSystemInfoSync(); + return compareVersion(system.SDKVersion, '2.10.3') >= 0; +} diff --git a/dist/grid-item/index.js b/dist/grid-item/index.js index 88b97add..7a88a284 100644 --- a/dist/grid-item/index.js +++ b/dist/grid-item/index.js @@ -13,6 +13,7 @@ VantComponent({ icon: String, dot: Boolean, info: null, + badge: null, text: String, useSlot: Boolean, }, @@ -28,7 +29,16 @@ VantComponent({ return; } const { data, children } = this.parent; - const { columnNum, border, square, gutter, clickable, center } = data; + const { + columnNum, + border, + square, + gutter, + clickable, + center, + direction, + iconSize, + } = data; const width = `${100 / columnNum}%`; const styleWrapper = []; styleWrapper.push(`width: ${width}`); @@ -39,7 +49,7 @@ VantComponent({ const gutterValue = addUnit(gutter); styleWrapper.push(`padding-right: ${gutterValue}`); const index = children.indexOf(this); - if (index >= columnNum) { + if (index >= columnNum && !square) { styleWrapper.push(`margin-top: ${gutterValue}`); } } @@ -60,6 +70,8 @@ VantComponent({ square, gutter, clickable, + direction, + iconSize, }); }, onClick() { diff --git a/dist/grid-item/index.wxml b/dist/grid-item/index.wxml index 061f43c3..a27c06f1 100644 --- a/dist/grid-item/index.wxml +++ b/dist/grid-item/index.wxml @@ -2,7 +2,7 @@ @@ -10,7 +10,7 @@ - + diff --git a/dist/grid-item/index.wxss b/dist/grid-item/index.wxss index 7f2e8182..b7e0301e 100644 --- a/dist/grid-item/index.wxss +++ b/dist/grid-item/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-grid-item{position:relative;float:left;box-sizing:border-box}.van-grid-item--square{height:0}.van-grid-item__content{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;box-sizing:border-box;height:100%;padding:16px 8px;padding:var(--grid-item-content-padding,16px 8px);background-color:#fff;background-color:var(--grid-item-content-background-color,#fff)}.van-grid-item__content:after{z-index:1;border-width:0 1px 1px 0;border-bottom-width:var(--border-width-base,1px);border-right-width:var(--border-width-base,1px);border-top-width:0}.van-grid-item__content--surround:after{border-width:1px;border-width:var(--border-width-base,1px)}.van-grid-item__content--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-grid-item__content--square{position:absolute;top:0;right:0;left:0}.van-grid-item__content--clickable:active{background-color:#f2f3f5;background-color:var(--grid-item-content-active-color,#f2f3f5)}.van-grid-item__icon{font-size:26px;font-size:var(--grid-item-icon-size,26px)}.van-grid-item__text{word-wrap:break-word;color:#646566;color:var(--grid-item-text-color,#646566);font-size:12px;font-size:var(--grid-item-text-font-size,12px)} \ No newline at end of file +@import '../common/index.wxss';.van-grid-item{position:relative;float:left;box-sizing:border-box}.van-grid-item--square{height:0}.van-grid-item__content{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;box-sizing:border-box;height:100%;padding:16px 8px;padding:var(--grid-item-content-padding,16px 8px);background-color:#fff;background-color:var(--grid-item-content-background-color,#fff)}.van-grid-item__content:after{z-index:1;border-width:0 1px 1px 0;border-bottom-width:var(--border-width-base,1px);border-right-width:var(--border-width-base,1px);border-top-width:0}.van-grid-item__content--surround:after{border-width:1px;border-width:var(--border-width-base,1px)}.van-grid-item__content--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-grid-item__content--square{position:absolute;top:0;right:0;left:0}.van-grid-item__content--horizontal{-webkit-flex-direction:row;flex-direction:row}.van-grid-item__content--horizontal .van-grid-item__icon+.van-grid-item__text{margin-top:0;margin-left:8px}.van-grid-item__content--clickable:active{background-color:#f2f3f5;background-color:var(--grid-item-content-active-color,#f2f3f5)}.van-grid-item__icon{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;font-size:26px;font-size:var(--grid-item-icon-size,26px);height:26px;height:var(--grid-item-icon-size,26px)}.van-grid-item__text{word-wrap:break-word;color:#646566;color:var(--grid-item-text-color,#646566);font-size:12px;font-size:var(--grid-item-text-font-size,12px)} \ No newline at end of file diff --git a/dist/grid/index.js b/dist/grid/index.js index aca001ba..a3bec16b 100644 --- a/dist/grid/index.js +++ b/dist/grid/index.js @@ -35,6 +35,14 @@ VantComponent({ value: true, observer: 'updateChildren', }, + direction: { + type: String, + observer: 'updateChildren', + }, + iconSize: { + type: String, + observer: 'updateChildren', + }, }, data: { viewStyle: '', diff --git a/dist/tag/index.wxss b/dist/tag/index.wxss index 211e3769..0615a993 100644 --- a/dist/tag/index.wxss +++ b/dist/tag/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-tag{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;line-height:normal;padding:.2em .5em;padding:var(--tag-padding,.2em .5em);color:#fff;color:var(--tag-text-color,#fff);font-size:10px;font-size:var(--tag-font-size,10px);border-radius:.2em;border-radius:var(--tag-border-radius,.2em)}.van-tag:after{border-color:currentColor;border-radius:.2em * 2;border-radius:var(--tag-border-radius,.2em) * 2}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-dander-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-dander-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--mark{padding-right:.7em}.van-tag--mark,.van-tag--mark:after{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--round,.van-tag--round:after{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag--medium{font-size:12px;font-size:var(--tag-medium-font-size,12px)}.van-tag--large{font-size:14px;font-size:var(--tag-large-font-size,14px)}.van-tag__close{margin-left:2px} \ No newline at end of file +@import '../common/index.wxss';.van-tag{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;line-height:normal;padding:.2em .5em;padding:var(--tag-padding,.2em .5em);color:#fff;color:var(--tag-text-color,#fff);font-size:10px;font-size:var(--tag-font-size,10px);border-radius:.2em;border-radius:var(--tag-border-radius,.2em)}.van-tag:after{border-color:currentColor;border-radius:.2em * 2;border-radius:var(--tag-border-radius,.2em) * 2}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--mark{padding-right:.7em}.van-tag--mark,.van-tag--mark:after{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--round,.van-tag--round:after{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag--medium{font-size:12px;font-size:var(--tag-medium-font-size,12px)}.van-tag--large{font-size:14px;font-size:var(--tag-large-font-size,14px)}.van-tag__close{margin-left:2px} \ No newline at end of file diff --git a/dist/uploader/index.wxml b/dist/uploader/index.wxml index 9abcf47b..09f76563 100644 --- a/dist/uploader/index.wxml +++ b/dist/uploader/index.wxml @@ -42,7 +42,7 @@ name="clear" class="van-uploader__preview-delete" data-index="{{ index }}" - bind:tap="deleteItem" + catch:tap="deleteItem" /> diff --git a/lib/button/index.js b/lib/button/index.js index 665c47c5..d38d35db 100644 --- a/lib/button/index.js +++ b/lib/button/index.js @@ -3,13 +3,19 @@ Object.defineProperty(exports, '__esModule', { value: true }); var component_1 = require('../common/component'); var button_1 = require('../mixins/button'); var open_type_1 = require('../mixins/open-type'); +var version_1 = require('../common/version'); +var mixins = [button_1.button, open_type_1.openType]; +if (version_1.canIUseFormFieldButton()) { + mixins.push('wx://form-field-button'); +} component_1.VantComponent({ - mixins: [button_1.button, open_type_1.openType], + mixins: mixins, classes: ['hover-class', 'loading-class'], data: { baseStyle: '', }, props: { + formType: String, icon: String, classPrefix: { type: String, diff --git a/lib/button/index.wxml b/lib/button/index.wxml index 30abac96..ab393e8f 100644 --- a/lib/button/index.wxml +++ b/lib/button/index.wxml @@ -6,6 +6,7 @@ class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}" hover-class="van-button--active hover-class" lang="{{ lang }}" + form-type="{{ formType }}" style="{{ baseStyle }} {{ customStyle }}" open-type="{{ disabled ? '' : openType }}" business-id="{{ businessId }}" diff --git a/lib/calendar/index.js b/lib/calendar/index.js index 370e76b2..699bbd81 100644 --- a/lib/calendar/index.js +++ b/lib/calendar/index.js @@ -304,7 +304,10 @@ component_1.VantComponent({ }, onConfirm: function () { var _this = this; - if (this.data.type === 'range' && !this.checkRange()) { + if ( + this.data.type === 'range' && + !this.checkRange(this.data.currentDate) + ) { return; } wx.nextTick(function () { diff --git a/lib/circle/canvas.js b/lib/circle/canvas.js new file mode 100644 index 00000000..dbee1d73 --- /dev/null +++ b/lib/circle/canvas.js @@ -0,0 +1,47 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.adaptor = void 0; +function adaptor(ctx) { + // @ts-ignore + return Object.assign(ctx, { + setStrokeStyle: function (val) { + ctx.strokeStyle = val; + }, + setLineWidth: function (val) { + ctx.lineWidth = val; + }, + setLineCap: function (val) { + ctx.lineCap = val; + }, + setFillStyle: function (val) { + ctx.fillStyle = val; + }, + setFontSize: function (val) { + ctx.font = String(val); + }, + setGlobalAlpha: function (val) { + ctx.globalAlpha = val; + }, + setLineJoin: function (val) { + ctx.lineJoin = val; + }, + setTextAlign: function (val) { + ctx.textAlign = val; + }, + setMiterLimit: function (val) { + ctx.miterLimit = val; + }, + setShadow: function (offsetX, offsetY, blur, color) { + ctx.shadowOffsetX = offsetX; + ctx.shadowOffsetY = offsetY; + ctx.shadowBlur = blur; + ctx.shadowColor = color; + }, + setTextBaseline: function (val) { + ctx.textBaseline = val; + }, + createCircularGradient: function () {}, + draw: function () {}, + }); +} +exports.adaptor = adaptor; diff --git a/lib/circle/index.js b/lib/circle/index.js index 487666da..296011c8 100644 --- a/lib/circle/index.js +++ b/lib/circle/index.js @@ -3,6 +3,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); var component_1 = require('../common/component'); var utils_1 = require('../common/utils'); var color_1 = require('../common/color'); +var canvas_1 = require('./canvas'); function format(rate) { return Math.min(Math.max(rate, 0), 100); } @@ -28,6 +29,9 @@ component_1.VantComponent({ size: { type: Number, value: 100, + observer: function () { + this.drawCircle(this.currentValue); + }, }, fill: String, layerColor: { @@ -57,40 +61,59 @@ component_1.VantComponent({ }, methods: { getContext: function () { - if (!this.ctx) { - this.ctx = wx.createCanvasContext('van-circle', this); + var _this = this; + var type = this.data.type; + if (type === '') { + var ctx = wx.createCanvasContext('van-circle', this); + return Promise.resolve(ctx); } - return this.ctx; + var dpr = wx.getSystemInfoSync().pixelRatio; + return new Promise(function (resolve) { + wx.createSelectorQuery() + .in(_this) + .select('#van-circle') + .fields({ node: true, size: true }) + .exec(function (res) { + var canvas = res[0].node; + var ctx = canvas.getContext(type); + canvas.width = res[0].width * dpr; + canvas.height = res[0].height * dpr; + ctx.scale(dpr, dpr); + resolve(canvas_1.adaptor(ctx)); + }); + }); }, setHoverColor: function () { + var _this = this; var _a = this.data, color = _a.color, - size = _a.size, - type = _a.type; - var context = type ? this.getContext(type) : this.getContext(); + size = _a.size; var hoverColor = color; - if (utils_1.isObj(color)) { - var LinearColor_1 = context.createLinearGradient(size, 0, 0, 0); - Object.keys(color) - .sort(function (a, b) { - return parseFloat(a) - parseFloat(b); - }) - .map(function (key) { - return LinearColor_1.addColorStop( - parseFloat(key) / 100, - color[key] - ); - }); - hoverColor = LinearColor_1; - } - this.setData({ hoverColor: hoverColor }); + this.getContext().then(function (context) { + if (utils_1.isObj(color)) { + var LinearColor_1 = context.createLinearGradient(size, 0, 0, 0); + Object.keys(color) + .sort(function (a, b) { + return parseFloat(a) - parseFloat(b); + }) + .map(function (key) { + return LinearColor_1.addColorStop( + parseFloat(key) / 100, + color[key] + ); + }); + hoverColor = LinearColor_1; + } + _this.setData({ hoverColor: hoverColor }); + }); }, presetCanvas: function (context, strokeStyle, beginAngle, endAngle, fill) { var _a = this.data, strokeWidth = _a.strokeWidth, lineCap = _a.lineCap, clockwise = _a.clockwise, - size = _a.size; + size = _a.size, + type = _a.type; var position = size / 2; var radius = position - strokeWidth / 2; context.setStrokeStyle(strokeStyle); @@ -122,17 +145,17 @@ component_1.VantComponent({ this.presetCanvas(context, hoverColor, BEGIN_ANGLE, endAngle); }, drawCircle: function (currentValue) { - var _a = this.data, - size = _a.size, - type = _a.type; - var context = type ? this.getContext(type) : this.getContext(); - context.clearRect(0, 0, size, size); - this.renderLayerCircle(context); - var formatValue = format(currentValue); - if (formatValue !== 0) { - this.renderHoverCircle(context, formatValue); - } - context.draw(); + var _this = this; + var size = this.data.size; + this.getContext().then(function (context) { + context.clearRect(0, 0, size, size); + _this.renderLayerCircle(context); + var formatValue = format(currentValue); + if (formatValue !== 0) { + _this.renderHoverCircle(context, formatValue); + } + context.draw(); + }); }, reRender: function () { var _this = this; @@ -172,7 +195,6 @@ component_1.VantComponent({ this.drawCircle(value); }, destroyed: function () { - this.ctx = null; this.clearInterval(); }, }); diff --git a/lib/circle/index.wxml b/lib/circle/index.wxml index 607fc9d5..52bc59fc 100644 --- a/lib/circle/index.wxml +++ b/lib/circle/index.wxml @@ -1,9 +1,9 @@ - + {{ text }} - \ No newline at end of file + diff --git a/lib/common/version.js b/lib/common/version.js index e0570922..50b90a56 100644 --- a/lib/common/version.js +++ b/lib/common/version.js @@ -1,6 +1,6 @@ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); -exports.canIUseModel = void 0; +exports.canIUseFormFieldButton = exports.canIUseModel = void 0; var utils_1 = require('./utils'); function compareVersion(v1, v2) { v1 = v1.split('.'); @@ -29,3 +29,8 @@ function canIUseModel() { return compareVersion(system.SDKVersion, '2.9.3') >= 0; } exports.canIUseModel = canIUseModel; +function canIUseFormFieldButton() { + var system = utils_1.getSystemInfoSync(); + return compareVersion(system.SDKVersion, '2.10.3') >= 0; +} +exports.canIUseFormFieldButton = canIUseFormFieldButton; diff --git a/lib/grid-item/index.js b/lib/grid-item/index.js index fbf3508a..1888ff1d 100644 --- a/lib/grid-item/index.js +++ b/lib/grid-item/index.js @@ -15,6 +15,7 @@ component_1.VantComponent({ icon: String, dot: Boolean, info: null, + badge: null, text: String, useSlot: Boolean, }, @@ -37,7 +38,9 @@ component_1.VantComponent({ square = data.square, gutter = data.gutter, clickable = data.clickable, - center = data.center; + center = data.center, + direction = data.direction, + iconSize = data.iconSize; var width = 100 / columnNum + '%'; var styleWrapper = []; styleWrapper.push('width: ' + width); @@ -48,7 +51,7 @@ component_1.VantComponent({ var gutterValue = utils_1.addUnit(gutter); styleWrapper.push('padding-right: ' + gutterValue); var index = children.indexOf(this); - if (index >= columnNum) { + if (index >= columnNum && !square) { styleWrapper.push('margin-top: ' + gutterValue); } } @@ -70,6 +73,8 @@ component_1.VantComponent({ square: square, gutter: gutter, clickable: clickable, + direction: direction, + iconSize: iconSize, }); }, onClick: function () { diff --git a/lib/grid-item/index.wxml b/lib/grid-item/index.wxml index 061f43c3..a27c06f1 100644 --- a/lib/grid-item/index.wxml +++ b/lib/grid-item/index.wxml @@ -2,7 +2,7 @@ @@ -10,7 +10,7 @@ - + diff --git a/lib/grid-item/index.wxss b/lib/grid-item/index.wxss index 7f2e8182..b7e0301e 100644 --- a/lib/grid-item/index.wxss +++ b/lib/grid-item/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-grid-item{position:relative;float:left;box-sizing:border-box}.van-grid-item--square{height:0}.van-grid-item__content{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;box-sizing:border-box;height:100%;padding:16px 8px;padding:var(--grid-item-content-padding,16px 8px);background-color:#fff;background-color:var(--grid-item-content-background-color,#fff)}.van-grid-item__content:after{z-index:1;border-width:0 1px 1px 0;border-bottom-width:var(--border-width-base,1px);border-right-width:var(--border-width-base,1px);border-top-width:0}.van-grid-item__content--surround:after{border-width:1px;border-width:var(--border-width-base,1px)}.van-grid-item__content--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-grid-item__content--square{position:absolute;top:0;right:0;left:0}.van-grid-item__content--clickable:active{background-color:#f2f3f5;background-color:var(--grid-item-content-active-color,#f2f3f5)}.van-grid-item__icon{font-size:26px;font-size:var(--grid-item-icon-size,26px)}.van-grid-item__text{word-wrap:break-word;color:#646566;color:var(--grid-item-text-color,#646566);font-size:12px;font-size:var(--grid-item-text-font-size,12px)} \ No newline at end of file +@import '../common/index.wxss';.van-grid-item{position:relative;float:left;box-sizing:border-box}.van-grid-item--square{height:0}.van-grid-item__content{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;box-sizing:border-box;height:100%;padding:16px 8px;padding:var(--grid-item-content-padding,16px 8px);background-color:#fff;background-color:var(--grid-item-content-background-color,#fff)}.van-grid-item__content:after{z-index:1;border-width:0 1px 1px 0;border-bottom-width:var(--border-width-base,1px);border-right-width:var(--border-width-base,1px);border-top-width:0}.van-grid-item__content--surround:after{border-width:1px;border-width:var(--border-width-base,1px)}.van-grid-item__content--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-grid-item__content--square{position:absolute;top:0;right:0;left:0}.van-grid-item__content--horizontal{-webkit-flex-direction:row;flex-direction:row}.van-grid-item__content--horizontal .van-grid-item__icon+.van-grid-item__text{margin-top:0;margin-left:8px}.van-grid-item__content--clickable:active{background-color:#f2f3f5;background-color:var(--grid-item-content-active-color,#f2f3f5)}.van-grid-item__icon{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;font-size:26px;font-size:var(--grid-item-icon-size,26px);height:26px;height:var(--grid-item-icon-size,26px)}.van-grid-item__text{word-wrap:break-word;color:#646566;color:var(--grid-item-text-color,#646566);font-size:12px;font-size:var(--grid-item-text-font-size,12px)} \ No newline at end of file diff --git a/lib/grid/index.js b/lib/grid/index.js index 155a5814..cb5c067a 100644 --- a/lib/grid/index.js +++ b/lib/grid/index.js @@ -37,6 +37,14 @@ component_1.VantComponent({ value: true, observer: 'updateChildren', }, + direction: { + type: String, + observer: 'updateChildren', + }, + iconSize: { + type: String, + observer: 'updateChildren', + }, }, data: { viewStyle: '', diff --git a/lib/tag/index.wxss b/lib/tag/index.wxss index 211e3769..0615a993 100644 --- a/lib/tag/index.wxss +++ b/lib/tag/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-tag{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;line-height:normal;padding:.2em .5em;padding:var(--tag-padding,.2em .5em);color:#fff;color:var(--tag-text-color,#fff);font-size:10px;font-size:var(--tag-font-size,10px);border-radius:.2em;border-radius:var(--tag-border-radius,.2em)}.van-tag:after{border-color:currentColor;border-radius:.2em * 2;border-radius:var(--tag-border-radius,.2em) * 2}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-dander-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-dander-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--mark{padding-right:.7em}.van-tag--mark,.van-tag--mark:after{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--round,.van-tag--round:after{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag--medium{font-size:12px;font-size:var(--tag-medium-font-size,12px)}.van-tag--large{font-size:14px;font-size:var(--tag-large-font-size,14px)}.van-tag__close{margin-left:2px} \ No newline at end of file +@import '../common/index.wxss';.van-tag{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;line-height:normal;padding:.2em .5em;padding:var(--tag-padding,.2em .5em);color:#fff;color:var(--tag-text-color,#fff);font-size:10px;font-size:var(--tag-font-size,10px);border-radius:.2em;border-radius:var(--tag-border-radius,.2em)}.van-tag:after{border-color:currentColor;border-radius:.2em * 2;border-radius:var(--tag-border-radius,.2em) * 2}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--mark{padding-right:.7em}.van-tag--mark,.van-tag--mark:after{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--round,.van-tag--round:after{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag--medium{font-size:12px;font-size:var(--tag-medium-font-size,12px)}.van-tag--large{font-size:14px;font-size:var(--tag-large-font-size,14px)}.van-tag__close{margin-left:2px} \ No newline at end of file diff --git a/lib/uploader/index.wxml b/lib/uploader/index.wxml index 9abcf47b..09f76563 100644 --- a/lib/uploader/index.wxml +++ b/lib/uploader/index.wxml @@ -42,7 +42,7 @@ name="clear" class="van-uploader__preview-delete" data-index="{{ index }}" - bind:tap="deleteItem" + catch:tap="deleteItem" />