From de8aa10f3d72970fb45bcdb81f8cb4b065f57386 Mon Sep 17 00:00:00 2001 From: rex-zsd Date: Mon, 25 May 2020 14:32:58 +0800 Subject: [PATCH 001/119] docs(changelog): release 1.3.1 --- docs/markdown/changelog.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/markdown/changelog.md b/docs/markdown/changelog.md index 80b9f0a3..d0b2b1b2 100644 --- a/docs/markdown/changelog.md +++ b/docs/markdown/changelog.md @@ -1,5 +1,17 @@ # 更新日志 +### [v1.3.1](https://github.com/youzan/vant-weapp/tree/v1.3.1) +`2020-05-24` + +**Features** + +- Button: 新增 class-prefix 属性 [\#3159](https://github.com/youzan/vant-weapp/pull/3159) +- Collapse: 新增 open、close 事件 [\#3176](https://github.com/youzan/vant-weapp/pull/3176) + +**Bug Fixes** + +- 修复控制台提示选择器错误的问题 [\#3137](https://github.com/youzan/vant-weapp/pull/3137) +- 修复 GoodsActionButton 在某些情况下报错的问题 [\#3145](https://github.com/youzan/vant-weapp/pull/3145) ### [v1.3.0](https://github.com/youzan/vant-weapp/tree/v1.3.0) `2020-05-08` diff --git a/package.json b/package.json index f3e753a2..1fb9283b 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "release": "sh build/release.sh", "release:site": "sh build/release-site.sh", "build:lib": "yarn && npx gulp -f build/compiler.js --series buildEs buildLib", - "build:changelog": "vant changelog --tag v1.1.0 ./docs/markdown/changelog.generated.md", + "build:changelog": "vant changelog --tag v1.3.0 ./docs/markdown/changelog.generated.md", "upload:weapp": "node build/upload.js" }, "files": [ From 3cf7ceebfb9e9f4388448ca0c3512ba63df53ea1 Mon Sep 17 00:00:00 2001 From: rex Date: Mon, 25 May 2020 14:41:03 +0800 Subject: [PATCH 002/119] fix(tag): fix wrong css variable name (#3191) fix #3185 --- packages/common/style/var.less | 2 +- packages/tag/index.less | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/common/style/var.less b/packages/common/style/var.less index 093dd9d4..88655283 100644 --- a/packages/common/style/var.less +++ b/packages/common/style/var.less @@ -506,7 +506,7 @@ @tag-text-color: @white; @tag-border-radius: 0.2em; @tag-round-border-radius: @border-radius-max; -@tag-dander-color: @red; +@tag-danger-color: @red; @tag-primary-color: @blue; @tag-success-color: @green; @tag-warning-color: @orange; diff --git a/packages/tag/index.less b/packages/tag/index.less index fb4093a9..a26b2c68 100644 --- a/packages/tag/index.less +++ b/packages/tag/index.less @@ -24,10 +24,10 @@ } &--danger { - .theme(background-color, '@tag-dander-color'); + .theme(background-color, '@tag-danger-color'); &.van-tag--plain { - .theme(color, '@tag-dander-color'); + .theme(color, '@tag-danger-color'); } } From 3a37327ec158743720f81d375e8efa3a0e8113b5 Mon Sep 17 00:00:00 2001 From: rex Date: Mon, 25 May 2020 15:18:20 +0800 Subject: [PATCH 003/119] feat(grid): add new prop direction (#3192) fix #3180 --- example/pages/grid/index.wxml | 8 +++++++- packages/grid-item/index.less | 13 +++++++++++++ packages/grid-item/index.ts | 11 ++++++++++- packages/grid-item/index.wxml | 2 +- packages/grid/index.ts | 4 ++++ 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/example/pages/grid/index.wxml b/example/pages/grid/index.wxml index e6f6cbfa..56280724 100644 --- a/example/pages/grid/index.wxml +++ b/example/pages/grid/index.wxml @@ -30,6 +30,12 @@ + + + + + + @@ -37,7 +43,7 @@ - + diff --git a/packages/grid-item/index.less b/packages/grid-item/index.less index c43fc105..d824ab8a 100644 --- a/packages/grid-item/index.less +++ b/packages/grid-item/index.less @@ -41,13 +41,26 @@ left: 0; } + &--horizontal { + flex-direction: row; + + .van-grid-item__icon + .van-grid-item__text { + margin-top: 0; + margin-left: @padding-xs; + } + } + &--clickable:active { .theme(background-color, '@grid-item-content-active-color'); } } &__icon { + display: flex; + align-items: center; + .theme(font-size, '@grid-item-icon-size'); + .theme(height, '@grid-item-icon-size'); } &__text { diff --git a/packages/grid-item/index.ts b/packages/grid-item/index.ts index f20f9c4c..1678b601 100644 --- a/packages/grid-item/index.ts +++ b/packages/grid-item/index.ts @@ -36,7 +36,15 @@ VantComponent({ } const { data, children } = this.parent; - const { columnNum, border, square, gutter, clickable, center } = data; + const { + columnNum, + border, + square, + gutter, + clickable, + center, + direction, + } = data; const width = `${100 / columnNum}%`; const styleWrapper = []; @@ -76,6 +84,7 @@ VantComponent({ square, gutter, clickable, + direction, }); }, diff --git a/packages/grid-item/index.wxml b/packages/grid-item/index.wxml index 061f43c3..57a96281 100644 --- a/packages/grid-item/index.wxml +++ b/packages/grid-item/index.wxml @@ -2,7 +2,7 @@ diff --git a/packages/grid/index.ts b/packages/grid/index.ts index 4332b3fc..fdc1b32b 100644 --- a/packages/grid/index.ts +++ b/packages/grid/index.ts @@ -37,6 +37,10 @@ VantComponent({ value: true, observer: 'updateChildren', }, + direction: { + type: String, + observer: 'updateChildren', + }, }, data: { From 1dc1960694d5c4768d7f647cdeab8bdc5bab06b8 Mon Sep 17 00:00:00 2001 From: rex Date: Wed, 27 May 2020 15:24:13 +0800 Subject: [PATCH 004/119] feat(button): add new prop form-type (#3208) fix #3204 --- packages/button/README.md | 1 + packages/button/index.ts | 3 ++- packages/button/index.wxml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/button/README.md b/packages/button/README.md index c5c03135..8935c8e0 100644 --- a/packages/button/README.md +++ b/packages/button/README.md @@ -142,6 +142,7 @@ | send-message-img | sendMessageImg | _string_ | 截图 | - | | show-message-card | 显示会话内消息卡片 | _string_ | `false` | - | | dataset | 按钮 dataset,open-type 为 `share` 时,可在 onShareAppMessage 事件的 `event.target.dataset.detail` 中看到传入的值 | _any_ | - | - | +| form-type | 用于 form 组件,可选值为`submit` `reset`,点击分别会触发 form 组件的 submit/reset 事件 | _string_ | - | - | ### Events diff --git a/packages/button/index.ts b/packages/button/index.ts index 840d0f5b..37941126 100644 --- a/packages/button/index.ts +++ b/packages/button/index.ts @@ -3,7 +3,7 @@ import { button } from '../mixins/button'; import { openType } from '../mixins/open-type'; VantComponent({ - mixins: [button, openType], + mixins: [button, openType, 'wx://form-field-button'], classes: ['hover-class', 'loading-class'], @@ -12,6 +12,7 @@ VantComponent({ }, props: { + formType: String, icon: String, classPrefix: { type: String, diff --git a/packages/button/index.wxml b/packages/button/index.wxml index 30abac96..ab393e8f 100644 --- a/packages/button/index.wxml +++ b/packages/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 }}" From 662fe0a8ef22b5a9e8f8c873b961b68403e27c50 Mon Sep 17 00:00:00 2001 From: rex Date: Wed, 27 May 2020 15:33:18 +0800 Subject: [PATCH 005/119] docs(tag): add prop closable doc (#3209) fix #3200 --- packages/tag/README.md | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/packages/tag/README.md b/packages/tag/README.md index 72a9dbf7..758e5817 100644 --- a/packages/tag/README.md +++ b/packages/tag/README.md @@ -78,6 +78,50 @@ 标签 ``` +### 可关闭标签 + +添加`closeable`属性表示标签是可关闭的,关闭标签时会触发`close`事件,在`close`事件中可以执行隐藏标签的逻辑 + +```html + + 标签 + + + 标签 + +``` + +```js +Page({ + data: { + show: { + primary: true, + success: true, + }, + }, + + onClose(event) { + this.setData({ + [`show.${event.target.id}`]: false, + }); + }, +}); +``` + ## API ### Props @@ -91,6 +135,7 @@ | round | 是否为圆角样式 | _boolean_ | `false` | - | | mark | 是否为标记样式 | _boolean_ | `false` | - | | text-color | 文本颜色,优先级高于`color`属性 | _string_ | `white` | - | +| closeable | 是否为可关闭标签 | _boolean_ | `false` | ### Slot @@ -98,6 +143,12 @@ | ---- | ------------------- | | - | 自定义 Tag 显示内容 | +### Events + +| 事件名 | 说明 | 回调参数 | +| ------ | -------------- | -------- | +| close | 关闭标签时触发 | - | + ### 外部样式类 | 类名 | 说明 | From 6fee285b080938a613db4db82977b24642410f8f Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 28 May 2020 11:26:15 +0800 Subject: [PATCH 006/119] build: add actions to sync to gitee (#3212) --- .github/workflows/sync.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 00000000..30cbac7d --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,30 @@ +name: Sync to Gitee + +on: + push: + branches: [dev] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Sync to Gitee + uses: wearerequired/git-mirror-action@master + env: + # 注意在 Settings->Secrets 配置 GITEE_RSA_PRIVATE_KEY + SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} + with: + # 注意替换为你的 GitHub 源仓库地址 + source-repo: 'git@github.com:youzan/vant-weapp.git' + # 注意替换为你的 Gitee 目标仓库地址 + destination-repo: 'git@gitee.com:vant-contrib/vant-weapp.git' + + - name: Build Gitee Pages + uses: yanglbme/gitee-pages-action@master + with: + # 注意替换为你的 Gitee 用户名 + gitee-username: chenjiahan + # 注意在 Settings->Secrets 配置 GITEE_PASSWORD + gitee-password: ${{ secrets.GITEE_PASSWORD }} + # 注意替换为你的 Gitee 仓库 + gitee-repo: vant-contrib/vant-weapp From 5ccc355e3d90cd6b7c55d81995aeaff37d7d8388 Mon Sep 17 00:00:00 2001 From: f00bar <2937443168@qq.com> Date: Sun, 31 May 2020 00:19:18 +0800 Subject: [PATCH 007/119] docs: typo fix in uploader (#3224) --- packages/uploader/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uploader/README.md b/packages/uploader/README.md index d44f6312..d5026619 100644 --- a/packages/uploader/README.md +++ b/packages/uploader/README.md @@ -85,7 +85,7 @@ Page({ fileList: [ { url: 'https://img.yzcdn.cn/vant/leaf.jpg', - statue: 'uploading', + status: 'uploading', message: '上传中', }, { From f40a5fbe97f3d9f9f51c1a8040104c6c65ab5009 Mon Sep 17 00:00:00 2001 From: rex Date: Tue, 2 Jun 2020 21:40:34 +0800 Subject: [PATCH 008/119] fix(circle): fix type not work (#3228) fix #3168 --- example/pages/circle/index.wxml | 2 +- package.json | 2 +- packages/circle/README.md | 2 +- packages/circle/canvas.ts | 47 +++++++++++++++++++ packages/circle/index.ts | 81 ++++++++++++++++++++++----------- packages/circle/index.wxml | 4 +- yarn.lock | 8 ++-- 7 files changed, 110 insertions(+), 36 deletions(-) create mode 100644 packages/circle/canvas.ts diff --git a/example/pages/circle/index.wxml b/example/pages/circle/index.wxml index a1175caf..02ca4048 100644 --- a/example/pages/circle/index.wxml +++ b/example/pages/circle/index.wxml @@ -1,5 +1,5 @@ - + diff --git a/package.json b/package.json index 1fb9283b..c10c9dec 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "less": "^3.9.0", "less-loader": "^5.0.0", "lint-staged": "^10.0.0", - "miniprogram-api-typings": "2.10.4", + "miniprogram-api-typings": "2.11.0", "miniprogram-ci": "^1.0.27", "postcss-loader": "^3.0.0", "prettier": "^2.0.5", diff --git a/packages/circle/README.md b/packages/circle/README.md index ff7cf0c9..df3d171d 100644 --- a/packages/circle/README.md +++ b/packages/circle/README.md @@ -89,7 +89,7 @@ Page({ | 参数 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | | value | 目标进度 | _number_ | `0` | - | -| type | 指定 canvas 类型,可选值为 `2d` `webgl` | _string_ | - | - | +| type | 指定 canvas 类型,可选值为 `2d` | _string_ | - | - | | size | 圆环直径,默认单位为 `px` | _number_ | `100` | - | | color | 进度条颜色,传入对象格式可以定义渐变色 | _string \| object_ | `#1989fa` | - | | layer-color | 轨道颜色 | _string_ | `#fff` | - | diff --git a/packages/circle/canvas.ts b/packages/circle/canvas.ts new file mode 100644 index 00000000..c82724a9 --- /dev/null +++ b/packages/circle/canvas.ts @@ -0,0 +1,47 @@ +type CanvasContext = WechatMiniprogram.CanvasContext; + +export function adaptor( + ctx: CanvasRenderingContext2D +): CanvasContext & CanvasRenderingContext2D { + // @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/packages/circle/index.ts b/packages/circle/index.ts index 16718e2e..c8292308 100644 --- a/packages/circle/index.ts +++ b/packages/circle/index.ts @@ -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); @@ -28,6 +29,9 @@ VantComponent({ size: { type: Number, value: 100, + observer() { + this.drawCircle(this.currentValue); + }, }, fill: String, layerColor: { @@ -59,38 +63,60 @@ 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.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 }); + 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); context.setLineWidth(strokeWidth); context.setLineCap(lineCap); + context.beginPath(); context.arc(position, position, radius, beginAngle, endAngle, !clockwise); context.stroke(); @@ -118,17 +144,19 @@ VantComponent({ }, 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 { size } = this.data; - const formatValue = format(currentValue); - if (formatValue !== 0) { - this.renderHoverCircle(context, formatValue); - } + this.getContext().then((context) => { + context.clearRect(0, 0, size, size); + this.renderLayerCircle(context); - context.draw(); + const formatValue = format(currentValue); + if (formatValue !== 0) { + this.renderHoverCircle(context, formatValue); + } + + context.draw(); + }); }, reRender() { @@ -171,7 +199,6 @@ VantComponent({ }, destroyed() { - this.ctx = null; this.clearInterval(); }, }); diff --git a/packages/circle/index.wxml b/packages/circle/index.wxml index 607fc9d5..52bc59fc 100644 --- a/packages/circle/index.wxml +++ b/packages/circle/index.wxml @@ -1,9 +1,9 @@ - + {{ text }} - \ No newline at end of file + diff --git a/yarn.lock b/yarn.lock index 9b06e3cc..5cb57cb5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7978,10 +7978,10 @@ minimist@^1.2.0, minimist@^1.2.5: resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== -miniprogram-api-typings@2.10.4: - version "2.10.4" - resolved "https://registry.npmjs.org/miniprogram-api-typings/-/miniprogram-api-typings-2.10.4.tgz#13165d1e77084c3ec79ec93d8c74974f77425eb0" - integrity sha512-IXWi6sJFd/EH1wNR8rtOx2+hJOwZk7jKFVIshQ0aAlRaKk0P4Jack4SItzUwNURgRykvrleGgErI/jH5hsiniw== +miniprogram-api-typings@2.11.0: + version "2.11.0" + resolved "http://registry.npm.qima-inc.com/miniprogram-api-typings/download/miniprogram-api-typings-2.11.0.tgz#c0a91ca2fea80e344509399c580cbad504a8f905" + integrity sha1-wKkcov6oDjRFCTmcWAy61QSo+QU= miniprogram-ci@^1.0.27: version "1.0.29" From 9a508de397c6f723e2a77a06c919071abce07fb1 Mon Sep 17 00:00:00 2001 From: rex Date: Wed, 3 Jun 2020 11:03:28 +0800 Subject: [PATCH 009/119] fix(button): compatible form-field-button in low sdk version (#3229) --- example/project.config.json | 19 +++++++++++++++++-- packages/button/index.ts | 8 +++++++- packages/common/version.ts | 5 +++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/example/project.config.json b/example/project.config.json index 78e2d532..885a07ff 100644 --- a/example/project.config.json +++ b/example/project.config.json @@ -7,13 +7,28 @@ "urlCheck": false, "es6": true, "postcss": true, + "preloadBackgroundData": false, "minified": true, "newFeature": true, - "nodeModules": true + "coverView": true, + "nodeModules": true, + "autoAudits": false, + "showShadowRootInWxmlPanel": true, + "scopeDataCheck": false, + "checkInvalidKey": true, + "checkSiteMap": true, + "uploadWithSourceMap": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "useCompilerModule": false, + "userConfirmedUseCompilerModuleSwitch": false }, "compileType": "miniprogram", "cloudfunctionRoot": "functions/", - "libVersion": "2.9.3", + "libVersion": "2.3.0", "appid": "wx1c01b35002d3ba14", "projectname": "vant-weapp", "debugOptions": { diff --git a/packages/button/index.ts b/packages/button/index.ts index 37941126..7880e621 100644 --- a/packages/button/index.ts +++ b/packages/button/index.ts @@ -1,9 +1,15 @@ 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, 'wx://form-field-button'], + mixins, classes: ['hover-class', 'loading-class'], diff --git a/packages/common/version.ts b/packages/common/version.ts index 593f9f5c..ca3eba1b 100644 --- a/packages/common/version.ts +++ b/packages/common/version.ts @@ -31,3 +31,8 @@ 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; +} From 02bf7e857bc12fa7e79f354f056a8bb40457caa4 Mon Sep 17 00:00:00 2001 From: rex Date: Wed, 3 Jun 2020 11:08:34 +0800 Subject: [PATCH 010/119] fix(uploader): avoid emit click-preview event in delete event (#3230) fix #3216 --- packages/uploader/index.wxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uploader/index.wxml b/packages/uploader/index.wxml index 9abcf47b..09f76563 100644 --- a/packages/uploader/index.wxml +++ b/packages/uploader/index.wxml @@ -42,7 +42,7 @@ name="clear" class="van-uploader__preview-delete" data-index="{{ index }}" - bind:tap="deleteItem" + catch:tap="deleteItem" /> From d1cc1276ad8d62ebb7e75b1f89b672da8acd15f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E9=A3=8E?= Date: Wed, 3 Jun 2020 11:30:33 +0800 Subject: [PATCH 011/119] =?UTF-8?q?fix(calendar):=20=E5=9C=A8=E5=A4=9A?= =?UTF-8?q?=E9=80=89=E6=97=A5=E6=9C=9F=E7=8A=B6=E6=80=81=E4=B8=8B,?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=AE=8C=E5=90=8E=E7=82=B9=E7=A1=AE=E5=AE=9A?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=8A=A5=E9=94=99=20(#3195)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/calendar/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/calendar/index.ts b/packages/calendar/index.ts index 9386f2f8..cecf91b8 100644 --- a/packages/calendar/index.ts +++ b/packages/calendar/index.ts @@ -316,7 +316,7 @@ VantComponent({ }, onConfirm() { - if (this.data.type === 'range' && !this.checkRange()) { + if (this.data.type === 'range' && !this.checkRange(this.data.currentDate)) { return; } wx.nextTick(() => { From 29f1628c0077c1646248efba466cb6ccae192ca9 Mon Sep 17 00:00:00 2001 From: rex Date: Wed, 3 Jun 2020 17:36:06 +0800 Subject: [PATCH 012/119] feat(grid): add new prop icon-size & badge (#3236) fix #3223 --- example/pages/grid/index.wxml | 2 +- packages/grid-item/index.ts | 3 +++ packages/grid-item/index.wxml | 2 +- packages/grid/README.md | 7 ++++--- packages/grid/index.ts | 4 ++++ 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/example/pages/grid/index.wxml b/example/pages/grid/index.wxml index 56280724..1f1e0942 100644 --- a/example/pages/grid/index.wxml +++ b/example/pages/grid/index.wxml @@ -46,6 +46,6 @@ - + diff --git a/packages/grid-item/index.ts b/packages/grid-item/index.ts index 1678b601..beaaeeee 100644 --- a/packages/grid-item/index.ts +++ b/packages/grid-item/index.ts @@ -17,6 +17,7 @@ VantComponent({ icon: String, dot: Boolean, info: null, + badge: null, text: String, useSlot: Boolean, }, @@ -44,6 +45,7 @@ VantComponent({ clickable, center, direction, + iconSize, } = data; const width = `${100 / columnNum}%`; @@ -85,6 +87,7 @@ VantComponent({ gutter, clickable, direction, + iconSize, }); }, diff --git a/packages/grid-item/index.wxml b/packages/grid-item/index.wxml index 57a96281..a27c06f1 100644 --- a/packages/grid-item/index.wxml +++ b/packages/grid-item/index.wxml @@ -10,7 +10,7 @@ - + diff --git a/packages/grid/README.md b/packages/grid/README.md index 9ba1d8de..d788a385 100644 --- a/packages/grid/README.md +++ b/packages/grid/README.md @@ -100,12 +100,12 @@ ### 提示信息 -设置`dot`属性后,会在图标右上角展示一个小红点。设置`info`属性后,会在图标右上角展示相应的徽标 +设置`dot`属性后,会在图标右上角展示一个小红点。设置`badge`属性后,会在图标右上角展示相应的徽标 ```html - + ``` @@ -116,6 +116,7 @@ | 参数 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | | column-num | 列数 | _number_ | `4` | - | +| icon-size `v1.3.2` | 图标大小,默认单位为`px` | _string_ | `28px` | | gutter | 格子之间的间距,默认单位为`px` | _string \| number_ | `0` | - | | border | 是否显示边框 | _boolean_ | `true` | - | | center | 是否将格子内容居中显示 | _boolean_ | `true` | - | @@ -136,7 +137,7 @@ | text | 文字 | _string_ | - | - | | icon | 图标名称或图片链接,可选值见 [Icon 组件](#/icon) | _string_ | - | - | | dot | 是否显示图标右上角小红点 | _boolean_ | `false` | - | -| info | 图标右上角徽标的内容 | _string \| number_ | - | - | +| badge | 图标右上角徽标的内容 | _string \| number_ | - | - | | url | 点击后跳转的链接地址 | _string_ | - | - | | link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | _string_ | `navigateTo` | - | diff --git a/packages/grid/index.ts b/packages/grid/index.ts index fdc1b32b..d81436c4 100644 --- a/packages/grid/index.ts +++ b/packages/grid/index.ts @@ -41,6 +41,10 @@ VantComponent({ type: String, observer: 'updateChildren', }, + iconSize: { + type: String, + observer: 'updateChildren', + }, }, data: { From 107782364acc3955ed7e25d91f9327d74ffc1d09 Mon Sep 17 00:00:00 2001 From: Lindy <33708359+Lindysen@users.noreply.github.com> Date: Wed, 3 Jun 2020 17:50:02 +0800 Subject: [PATCH 013/119] fix(Grid): fix square item gutter bug (#3231) --- packages/grid-item/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grid-item/index.ts b/packages/grid-item/index.ts index beaaeeee..ceecd1f7 100644 --- a/packages/grid-item/index.ts +++ b/packages/grid-item/index.ts @@ -61,7 +61,7 @@ VantComponent({ styleWrapper.push(`padding-right: ${gutterValue}`); const index = children.indexOf(this); - if (index >= columnNum) { + if (index >= columnNum && !square) { styleWrapper.push(`margin-top: ${gutterValue}`); } } From 547963140309b83a9afb5da02d16cbec55440612 Mon Sep 17 00:00:00 2001 From: rex Date: Thu, 4 Jun 2020 12:02:52 +0800 Subject: [PATCH 014/119] docs(popup): add doc for scroll (#3238) fix #3175 --- packages/popup/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/popup/README.md b/packages/popup/README.md index 51dfc643..38b791d5 100644 --- a/packages/popup/README.md +++ b/packages/popup/README.md @@ -103,6 +103,22 @@ Page({ /> ``` +## 常见问题 + +### 组件滚动穿透该怎么解决? + +使用组件时,会发现内容部分滚动到底时,继续划动会导致页面的滚动,这就是滚动穿透。 + +在web中,可以通过给 body 增加样式或者劫持内容部分的 `touchstart` 事件,判断后动态调用 `preventDefault` 来实现。不幸的是,这两种方法在小程序中都是不可行的,组件内部无法很好地处理滚动穿透问题。 + +如果你有禁止滚动的需要,可以显式地 `catch` 组件的 `touchstart` 事件,不过需要注意的是,这也会禁止组件内容部分的滚动。 +```html + +``` + ## API ### Props From 8aac1ebed07fb64c42f2720030224637761ae22c Mon Sep 17 00:00:00 2001 From: rex Date: Thu, 4 Jun 2020 14:09:03 +0800 Subject: [PATCH 015/119] build: compile 1.3.2 --- dist/button/index.js | 8 +++- dist/button/index.wxml | 1 + dist/calendar/index.js | 5 ++- dist/circle/canvas.d.ts | 6 +++ dist/circle/canvas.js | 43 +++++++++++++++++++ dist/circle/index.js | 73 ++++++++++++++++++++----------- dist/circle/index.wxml | 4 +- dist/common/version.d.ts | 1 + dist/common/version.js | 4 ++ dist/grid-item/index.js | 16 ++++++- dist/grid-item/index.wxml | 4 +- dist/grid-item/index.wxss | 2 +- dist/grid/index.js | 8 ++++ dist/tag/index.wxss | 2 +- dist/uploader/index.wxml | 2 +- lib/button/index.js | 8 +++- lib/button/index.wxml | 1 + lib/calendar/index.js | 5 ++- lib/circle/canvas.js | 47 ++++++++++++++++++++ lib/circle/index.js | 90 ++++++++++++++++++++++++--------------- lib/circle/index.wxml | 4 +- lib/common/version.js | 7 ++- lib/grid-item/index.js | 9 +++- lib/grid-item/index.wxml | 4 +- lib/grid-item/index.wxss | 2 +- lib/grid/index.js | 8 ++++ lib/tag/index.wxss | 2 +- lib/uploader/index.wxml | 2 +- 28 files changed, 285 insertions(+), 83 deletions(-) create mode 100644 dist/circle/canvas.d.ts create mode 100644 dist/circle/canvas.js create mode 100644 lib/circle/canvas.js 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" /> From 3f1d1498f6d6728e8b3575e36813034c4b260f11 Mon Sep 17 00:00:00 2001 From: rex Date: Thu, 4 Jun 2020 14:09:07 +0800 Subject: [PATCH 016/119] build: release 1.3.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c10c9dec..49da7961 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vant/weapp", - "version": "1.3.1", + "version": "1.3.2", "author": "youzan", "license": "MIT", "miniprogram": "lib", From 4f4e6af9a6bdd53fc04b3b9dbd6e9c19a30b4048 Mon Sep 17 00:00:00 2001 From: rex-zsd Date: Thu, 4 Jun 2020 14:38:06 +0800 Subject: [PATCH 017/119] docs: release 1.3.2 --- docs/markdown/changelog.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/markdown/changelog.md b/docs/markdown/changelog.md index d0b2b1b2..5a62d558 100644 --- a/docs/markdown/changelog.md +++ b/docs/markdown/changelog.md @@ -1,5 +1,22 @@ # 更新日志 +### [v1.3.2](https://github.com/youzan/vant-weapp/tree/v1.3.2) +`2020-06-04` + +**Features** + +- button: 新增 form-type 属性 [\#3208](https://github.com/youzan/vant-weapp/pull/3208) +- grid: 新增 icon-size、badge 属性 [\#3236](https://github.com/youzan/vant-weapp/pull/3236) +- grid: 新增 direction 属性 [\#3192](https://github.com/youzan/vant-weapp/pull/3192) + +**Bug Fixes** + +- Grid: 修复开启 `square` 时横、纵向间距不同 [\#3231](https://github.com/youzan/vant-weapp/pull/3231) +- uploader: 修复点击删除图标时触发 click-preview 事件 [\#3230](https://github.com/youzan/vant-weapp/pull/3230) +- circle: 修复 `type="2d"` 不生效 [\#3228](https://github.com/youzan/vant-weapp/pull/3228) +- calendar: 修复在选择区间时,点击确定报错 [\#3195](https://github.com/youzan/vant-weapp/pull/3195) +- tag: 修复 css 变量名拼写错误 [\#3191](https://github.com/youzan/vant-weapp/pull/3191) + ### [v1.3.1](https://github.com/youzan/vant-weapp/tree/v1.3.1) `2020-05-24` From 67dfb120c37875ace0c4b7294f446553b153dc4f Mon Sep 17 00:00:00 2001 From: rex Date: Tue, 9 Jun 2020 17:59:15 +0800 Subject: [PATCH 018/119] fix(nav-bar): fix style error with no left-text (#3263) fix #3250 --- example/pages/nav-bar/index.wxml | 3 +- example/project.config.json | 2 +- packages/nav-bar/index.less | 5 +++ packages/nav-bar/index.ts | 5 +-- packages/nav-bar/index.wxml | 54 +++++++++++++++++--------------- 5 files changed, 38 insertions(+), 31 deletions(-) diff --git a/example/pages/nav-bar/index.wxml b/example/pages/nav-bar/index.wxml index e25fb13a..b61ba556 100644 --- a/example/pages/nav-bar/index.wxml +++ b/example/pages/nav-bar/index.wxml @@ -1,7 +1,6 @@ - + diff --git a/example/project.config.json b/example/project.config.json index 885a07ff..5f82a265 100644 --- a/example/project.config.json +++ b/example/project.config.json @@ -23,7 +23,7 @@ "disablePlugins": [], "outputPath": "" }, - "useCompilerModule": false, + "useCompilerModule": true, "userConfirmedUseCompilerModuleSwitch": false }, "compileType": "miniprogram", diff --git a/packages/nav-bar/index.less b/packages/nav-bar/index.less index 256bd8d1..e11d4b72 100644 --- a/packages/nav-bar/index.less +++ b/packages/nav-bar/index.less @@ -9,6 +9,10 @@ .theme(line-height, '@nav-bar-height'); .theme(background-color, '@nav-bar-background-color'); + &__content { + position: relative; + } + &__text { display: inline-block; vertical-align: middle; @@ -50,6 +54,7 @@ &__left, &__right { position: absolute; + top: 0; bottom: 0; display: flex; align-items: center; diff --git a/packages/nav-bar/index.ts b/packages/nav-bar/index.ts index 3386e2f2..88c51b5b 100644 --- a/packages/nav-bar/index.ts +++ b/packages/nav-bar/index.ts @@ -1,4 +1,5 @@ import { VantComponent } from '../common/component'; +import { getSystemInfoSync } from '../common/utils'; VantComponent({ classes: ['title-class'], @@ -38,14 +39,14 @@ VantComponent({ }, created() { - const { statusBarHeight } = wx.getSystemInfoSync(); + const { statusBarHeight } = getSystemInfoSync(); const { safeAreaInsetTop, zIndex } = this.data; const paddingTop = safeAreaInsetTop ? statusBarHeight : 0; const baseStyle = `z-index: ${zIndex};padding-top: ${paddingTop}px;`; this.setData({ statusBarHeight, height: 44 + statusBarHeight, - baseStyle + baseStyle, }); }, diff --git a/packages/nav-bar/index.wxml b/packages/nav-bar/index.wxml index 941bf563..27ba8c96 100644 --- a/packages/nav-bar/index.wxml +++ b/packages/nav-bar/index.wxml @@ -4,36 +4,38 @@ - - - + + + + + {{ leftText }} + + + + + {{ title }} + + + {{ leftText }} - - - - - {{ title }} - - - - {{ rightText }} - + >{{ rightText }} + + From e16d611f9427a2e38705c8c1736e66b6c1607680 Mon Sep 17 00:00:00 2001 From: rex Date: Tue, 9 Jun 2020 20:59:39 +0800 Subject: [PATCH 019/119] fix(circle): can not set value dynamic (#3264) fix #3239 --- packages/circle/index.ts | 50 ++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/packages/circle/index.ts b/packages/circle/index.ts index c8292308..0a9f4f2f 100644 --- a/packages/circle/index.ts +++ b/packages/circle/index.ts @@ -41,7 +41,11 @@ VantComponent({ color: { type: [String, Object], value: BLUE, - observer: 'setHoverColor', + observer() { + this.setHoverColor().then(() => { + this.drawCircle(this.currentValue); + }); + }, }, type: { type: String, @@ -63,7 +67,7 @@ VantComponent({ methods: { getContext() { - const { type } = this.data; + const { type, size } = this.data; if (type === '') { const ctx = wx.createCanvasContext('van-circle', this); @@ -76,14 +80,17 @@ VantComponent({ wx.createSelectorQuery() .in(this) .select('#van-circle') - .fields({ node: true, size: true }) + .node() .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); + if (!this.inited) { + this.inited = true; + canvas.width = size * dpr; + canvas.height = size * dpr; + ctx.scale(dpr, dpr); + } resolve(adaptor(ctx)); }); @@ -92,24 +99,25 @@ VantComponent({ setHoverColor() { const { color, size } = this.data; - let hoverColor = color; - this.getContext().then((context) => { - if (isObj(color)) { + if (isObj(color)) { + return this.getContext().then((context) => { 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.hoverColor = LinearColor; + }); + } - this.setData({ hoverColor }); - }); + this.hoverColor = color; + return Promise.resolve(); }, + presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) { - const { strokeWidth, lineCap, clockwise, size, type } = this.data; + const { strokeWidth, lineCap, clockwise, size } = this.data; const position = size / 2; const radius = position - strokeWidth / 2; @@ -133,14 +141,14 @@ VantComponent({ }, renderHoverCircle(context, formatValue) { - const { clockwise, hoverColor } = this.data; + const { clockwise } = this.data; // 结束角度 const progress = PERIMETER * (formatValue / 100); const endAngle = clockwise ? BEGIN_ANGLE + progress : 3 * Math.PI - (BEGIN_ANGLE + progress); - this.presetCanvas(context, hoverColor, BEGIN_ANGLE, endAngle); + this.presetCanvas(context, this.hoverColor, BEGIN_ANGLE, endAngle); }, drawCircle(currentValue) { @@ -192,10 +200,12 @@ VantComponent({ }, }, - created() { - const { value } = this.data; - this.currentValue = value; - this.drawCircle(value); + mounted() { + this.currentValue = this.data.value; + + this.setHoverColor().then(() => { + this.drawCircle(this.currentValue); + }); }, destroyed() { From 8456e58b4630f06d34592ef9b06c0210f45598a5 Mon Sep 17 00:00:00 2001 From: rex Date: Tue, 9 Jun 2020 21:23:43 +0800 Subject: [PATCH 020/119] perf(uploader): expand delete area (#3265) fix #3243 --- packages/uploader/index.less | 20 ++++++++++++++------ packages/uploader/index.wxml | 11 ++++++----- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/packages/uploader/index.less b/packages/uploader/index.less index 3a44e6df..8c6c3db0 100644 --- a/packages/uploader/index.less +++ b/packages/uploader/index.less @@ -66,12 +66,20 @@ &-delete { position: absolute; - top: -8px; - right: -8px; - color: @uploader-delete-color; - font-size: @uploader-delete-icon-size; - background-color: @uploader-delete-background-color; - border-radius: 100%; + top: 0; + right: 0; + z-index: 1; + display: flex; + padding: 10px; + border-radius: 50%; + transform: translate(50%, -50%); + + &__icon { + color: @uploader-delete-color; + font-size: @uploader-delete-icon-size; + background-color: @uploader-delete-background-color; + border-radius: 50%; + } } } diff --git a/packages/uploader/index.wxml b/packages/uploader/index.wxml index 09f76563..241e07f1 100644 --- a/packages/uploader/index.wxml +++ b/packages/uploader/index.wxml @@ -37,13 +37,14 @@ {{ item.message }} - + > + + @@ -57,7 +58,7 @@ wx:if="{{ showUpload }}" class="van-uploader__upload {{ disabled ? 'van-uploader__upload--disabled': ''}}" style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};" - bind:tap="startUpload" + bindtap="startUpload" > {{ uploadText }} From 9717d4170be5f8bec1220de70020ac90cc40107e Mon Sep 17 00:00:00 2001 From: rex Date: Tue, 16 Jun 2020 21:21:42 +0800 Subject: [PATCH 021/119] fix(calendar): fix default-date not work in multiple mode (#3284) fix #3271 --- packages/calendar/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/calendar/index.ts b/packages/calendar/index.ts index cecf91b8..00a899a7 100644 --- a/packages/calendar/index.ts +++ b/packages/calendar/index.ts @@ -165,7 +165,7 @@ VantComponent({ } if (type === 'multiple') { - return [defaultDate || minDate]; + return defaultDate || [minDate]; } return defaultDate || minDate; @@ -316,7 +316,10 @@ VantComponent({ }, onConfirm() { - if (this.data.type === 'range' && !this.checkRange(this.data.currentDate)) { + if ( + this.data.type === 'range' && + !this.checkRange(this.data.currentDate) + ) { return; } wx.nextTick(() => { From 9de507dd108e97937c74392b6b2bafe33f6e79a2 Mon Sep 17 00:00:00 2001 From: agoni1212 <22545824+agoni1212@users.noreply.github.com> Date: Tue, 16 Jun 2020 21:22:28 +0800 Subject: [PATCH 022/119] Update Grid direction README (#3266) * Update README.md * Update README.md --- packages/grid/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/grid/README.md b/packages/grid/README.md index d788a385..ddbde094 100644 --- a/packages/grid/README.md +++ b/packages/grid/README.md @@ -77,6 +77,18 @@ ``` +### 内容横排 + +将`direction`属性设置为`horizontal`,可以让宫格的内容呈横向排列 + +```html + + + + + +``` + ### 页面跳转 可以通过`url`属性进行页面跳转,通过`link-type`属性控制跳转类型 @@ -122,6 +134,7 @@ | center | 是否将格子内容居中显示 | _boolean_ | `true` | - | | square | 是否将格子固定为正方形 | _boolean_ | `false` | - | | clickable | 是否开启格子点击反馈 | _boolean_ | `false` | - | +| direction | 格子内容排列的方向,可选值为 `horizontal` | _string_ | `vertical` | - | | use-slot | 是否使用自定义内容的插槽 | _boolean_ | `false` | ### Grid 外部样式类 From d35649e88f64555d9aece4e2ca0151a73d2c5ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=A2=96=E5=8D=9A?= Date: Tue, 16 Jun 2020 21:25:43 +0800 Subject: [PATCH 023/119] =?UTF-8?q?fix:uploader=E7=BB=84=E4=BB=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8D=95=E5=BC=A0=E5=8F=AA=E8=AF=BB=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=20(#3270)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update index.wxml uploader组件,deletable属性只能控制全局是否可以删除,不能控制单张图片是否可删除,因此当fileList内为对象时,增加onlyRead标识,当onlyRead为true时,单张不显示删除icon; * Update index.wxml uploader组件,deletable属性只能控制全局是否可以删除,不能控制单张图片是否可删除,因此当fileList内为对象时,增加onlyRead标识,当onlyRead为true时,单张不显示删除icon; * 补充upload deletable 文档 * Update index.wxml * Update index.ts Co-authored-by: wangyingbo <> --- packages/uploader/README.md | 26 ++++++++++++++++++++++++++ packages/uploader/index.ts | 4 ++++ packages/uploader/index.wxml | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/uploader/README.md b/packages/uploader/README.md index d5026619..6ba1f0df 100644 --- a/packages/uploader/README.md +++ b/packages/uploader/README.md @@ -65,6 +65,32 @@ Page({ url: 'http://iph.href.lu/60x60?text=default', name: '图片2', isImage: true, + deletable: true, + }, + ], + }, +}); +``` + +### 图片编辑状态 + +通过`deletable `可以标识所有图片或者单张图片是否可删除。如果`Props `的全局`deletable `为`false`,则所有图片都不展示删除按钮;如果`Props `的全局`deletable `为`true`,则可通过设置每一个图片对象里的`deletable `来控制每一张图片是否显示删除按钮,如果图片对象里不设置则默认为`true`。 + +```html + +``` + +```js +Page({ + data: { + fileList: [ + { + url: 'https://img.yzcdn.cn/vant/leaf.jpg', + deletable: true, + }, + { + url: 'https://img.yzcdn.cn/vant/tree.jpg', + deletable: false, }, ], }, diff --git a/packages/uploader/index.ts b/packages/uploader/index.ts index 3bc81240..412c6c62 100644 --- a/packages/uploader/index.ts +++ b/packages/uploader/index.ts @@ -77,6 +77,10 @@ VantComponent({ typeof item.isImage === 'undefined' ? isImageFile(item) : item.isImage, + deletable: + typeof item.deletable === 'undefined' + ? true + : item.deletable, })); this.setData({ lists, isInCount: lists.length < maxCount }); }, diff --git a/packages/uploader/index.wxml b/packages/uploader/index.wxml index 241e07f1..bce0a495 100644 --- a/packages/uploader/index.wxml +++ b/packages/uploader/index.wxml @@ -38,7 +38,7 @@ {{ item.message }} Date: Wed, 24 Jun 2020 15:05:16 +0800 Subject: [PATCH 024/119] fix(grid): add margin-top for text with icon (#3310) fix #3307 --- packages/grid-item/index.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/grid-item/index.less b/packages/grid-item/index.less index d824ab8a..289aa122 100644 --- a/packages/grid-item/index.less +++ b/packages/grid-item/index.less @@ -68,4 +68,8 @@ .theme(color, '@grid-item-text-color'); .theme(font-size, '@grid-item-text-font-size'); } + + &__icon + &__text { + margin-top: 8px; + } } From 978b59650cbc0045826a51269ce0795b1a779367 Mon Sep 17 00:00:00 2001 From: rex Date: Wed, 24 Jun 2020 15:15:02 +0800 Subject: [PATCH 025/119] feat(field): add new external class label-class (#3311) fix #3285 --- packages/field/README.md | 1 + packages/field/index.ts | 2 +- packages/field/index.wxml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/field/README.md b/packages/field/README.md index 7effe7fe..b9aeaae7 100644 --- a/packages/field/README.md +++ b/packages/field/README.md @@ -260,5 +260,6 @@ Page({ | 类名 | 说明 | | ---------------- | -------------- | +| label-class | 左侧文本样式类 | | input-class | 输入框样式类 | | right-icon-class | 右侧图标样式类 | diff --git a/packages/field/index.ts b/packages/field/index.ts index 700e0e88..80c05be7 100644 --- a/packages/field/index.ts +++ b/packages/field/index.ts @@ -6,7 +6,7 @@ import { canIUseModel } from '../common/version'; VantComponent({ field: true, - classes: ['input-class', 'right-icon-class'], + classes: ['input-class', 'right-icon-class', 'label-class'], props: { ...commonProps, diff --git a/packages/field/index.wxml b/packages/field/index.wxml index 140f05b7..c984d897 100644 --- a/packages/field/index.wxml +++ b/packages/field/index.wxml @@ -14,6 +14,7 @@ custom-style="{{ customStyle }}" arrow-direction="{{ arrowDirection }}" custom-class="van-field" + title-class="label-class" > From b7ded1282f68dfc7dc205d9732dd948589f6e003 Mon Sep 17 00:00:00 2001 From: rex Date: Wed, 24 Jun 2020 15:55:27 +0800 Subject: [PATCH 026/119] fix(field): always set value after input (#3313) fix #3297 --- packages/field/index.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/field/index.ts b/packages/field/index.ts index 80c05be7..c4123e8c 100644 --- a/packages/field/index.ts +++ b/packages/field/index.ts @@ -1,7 +1,6 @@ import { VantComponent } from '../common/component'; import { Weapp } from 'definitions/weapp'; import { commonProps, inputProps, textareaProps } from './props'; -import { canIUseModel } from '../common/version'; VantComponent({ field: true, @@ -122,9 +121,7 @@ VantComponent({ }, emitChange() { - if (canIUseModel()) { - this.setData({ value: this.value }); - } + this.setData({ value: this.value }); wx.nextTick(() => { this.$emit('input', this.value); From 4e6efd1b8b9b9c79160128c9415b81092ac6846b Mon Sep 17 00:00:00 2001 From: rex Date: Wed, 24 Jun 2020 16:12:24 +0800 Subject: [PATCH 027/119] fix(tabbar): fix style error in iphonese (#3314) fix #2988 --- packages/tabbar/index.less | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/tabbar/index.less b/packages/tabbar/index.less index 33624a64..53132bf3 100644 --- a/packages/tabbar/index.less +++ b/packages/tabbar/index.less @@ -3,6 +3,7 @@ .van-tabbar { display: flex; + box-sizing: content-box; width: 100%; .theme(height, '@tabbar-height'); .theme(background-color, '@tabbar-background-color'); From c92f46756a524e154366ce200351b53b3bf93726 Mon Sep 17 00:00:00 2001 From: rex Date: Wed, 24 Jun 2020 17:06:01 +0800 Subject: [PATCH 028/119] feat(steps): add new steps properties inactiveIcon & activeIcon (#3315) fix #3111 --- example/pages/steps/index.js | 46 ++++++++++++++++++++-------------- example/pages/steps/index.wxml | 19 ++++++-------- packages/steps/README.md | 41 ++++++++++++++++++++++++++++++ packages/steps/index.wxml | 6 ++--- 4 files changed, 79 insertions(+), 33 deletions(-) diff --git a/example/pages/steps/index.js b/example/pages/steps/index.js index 44f710e7..84985871 100644 --- a/example/pages/steps/index.js +++ b/example/pages/steps/index.js @@ -1,32 +1,40 @@ import Page from '../../common/page'; import Toast from '../../dist/toast/toast'; +import icons from '../../dist/@vant/icons/src/config'; + +const steps = [ + { + text: '步骤一', + desc: '描述信息', + }, + { + text: '步骤二', + desc: '描述信息', + }, + { + text: '步骤三', + desc: '描述信息', + }, + { + text: '步骤四', + desc: '描述信息', + }, +]; Page({ data: { active: 1, - steps: [ - { - text: '步骤一', - desc: '描述信息' - }, - { - text: '步骤二', - desc: '描述信息' - }, - { - text: '步骤三', - desc: '描述信息' - }, - { - text: '步骤四', - desc: '描述信息' - } - ] + steps, + customIconSteps: steps.map((item, index) => ({ + ...item, + inactiveIcon: icons.outline[index], + activeIcon: icons.basic[index], + })), }, nextStep() { this.setData({ - active: ++this.data.active % 4 + active: ++this.data.active % 4, }); }, diff --git a/example/pages/steps/index.wxml b/example/pages/steps/index.wxml index c351b839..5bb24f6b 100644 --- a/example/pages/steps/index.wxml +++ b/example/pages/steps/index.wxml @@ -2,6 +2,7 @@ @@ -18,6 +19,13 @@ /> + + + + - - - - 下一步 - - diff --git a/packages/steps/README.md b/packages/steps/README.md index b48a1e82..b344e82f 100644 --- a/packages/steps/README.md +++ b/packages/steps/README.md @@ -56,6 +56,47 @@ Page({ /> ``` +### 自定义图标 + +可以通过 `inactiveIcon` 和 `activeIcon` 属性分别设置每一项的图标 + +```html + +``` + +```javascript +Page({ + data: { + steps: [ + { + text: '步骤一', + desc: '描述信息', + inactiveIcon: 'location-o', + activeIcon: 'success', + }, + { + text: '步骤二', + desc: '描述信息', + inactiveIcon: 'like-o', + activeIcon: 'plus', + }, + { + text: '步骤三', + desc: '描述信息', + inactiveIcon: 'star-o', + activeIcon: 'cross', + }, + { + text: '步骤四', + desc: '描述信息', + inactiveIcon: 'phone-o', + activeIcon: 'fail', + }, + ], + }, +}); +``` + ### 竖向步骤条 可以通过设置`direction`属性来改变步骤条的显示方式 diff --git a/packages/steps/index.wxml b/packages/steps/index.wxml index af31094f..6180b417 100644 --- a/packages/steps/index.wxml +++ b/packages/steps/index.wxml @@ -17,9 +17,9 @@ - + Date: Wed, 24 Jun 2020 17:08:49 +0800 Subject: [PATCH 029/119] build: compile 1.3.3 --- dist/calendar/index.js | 2 +- dist/circle/index.js | 48 ++++++++++++++++++------------- dist/field/index.js | 7 ++--- dist/field/index.wxml | 1 + dist/grid-item/index.wxss | 2 +- dist/nav-bar/index.js | 3 +- dist/nav-bar/index.wxml | 54 ++++++++++++++++++----------------- dist/nav-bar/index.wxss | 2 +- dist/steps/index.wxml | 6 ++-- dist/tabbar/index.wxss | 2 +- dist/uploader/index.js | 2 ++ dist/uploader/index.wxml | 13 +++++---- dist/uploader/index.wxss | 2 +- lib/calendar/index.js | 2 +- lib/circle/index.js | 59 ++++++++++++++++++++++----------------- lib/field/index.js | 7 ++--- lib/field/index.wxml | 1 + lib/grid-item/index.wxss | 2 +- lib/nav-bar/index.js | 3 +- lib/nav-bar/index.wxml | 54 ++++++++++++++++++----------------- lib/nav-bar/index.wxss | 2 +- lib/steps/index.wxml | 6 ++-- lib/tabbar/index.wxss | 2 +- lib/uploader/index.js | 2 ++ lib/uploader/index.wxml | 13 +++++---- lib/uploader/index.wxss | 2 +- 26 files changed, 162 insertions(+), 137 deletions(-) diff --git a/dist/calendar/index.js b/dist/calendar/index.js index 47117cbf..e953c6f4 100644 --- a/dist/calendar/index.js +++ b/dist/calendar/index.js @@ -152,7 +152,7 @@ VantComponent({ ]; } if (type === 'multiple') { - return [defaultDate || minDate]; + return defaultDate || [minDate]; } return defaultDate || minDate; }, diff --git a/dist/circle/index.js b/dist/circle/index.js index c11fcf08..3feaa5c8 100644 --- a/dist/circle/index.js +++ b/dist/circle/index.js @@ -39,7 +39,11 @@ VantComponent({ color: { type: [String, Object], value: BLUE, - observer: 'setHoverColor', + observer() { + this.setHoverColor().then(() => { + this.drawCircle(this.currentValue); + }); + }, }, type: { type: String, @@ -59,7 +63,7 @@ VantComponent({ }, methods: { getContext() { - const { type } = this.data; + const { type, size } = this.data; if (type === '') { const ctx = wx.createCanvasContext('van-circle', this); return Promise.resolve(ctx); @@ -69,35 +73,38 @@ VantComponent({ wx.createSelectorQuery() .in(this) .select('#van-circle') - .fields({ node: true, size: true }) + .node() .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); + if (!this.inited) { + this.inited = true; + canvas.width = size * dpr; + canvas.height = size * dpr; + ctx.scale(dpr, dpr); + } resolve(adaptor(ctx)); }); }); }, setHoverColor() { const { color, size } = this.data; - let hoverColor = color; - this.getContext().then((context) => { - if (isObj(color)) { + if (isObj(color)) { + return this.getContext().then((context) => { 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.hoverColor = LinearColor; + }); + } + this.hoverColor = color; + return Promise.resolve(); }, presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) { - const { strokeWidth, lineCap, clockwise, size, type } = this.data; + const { strokeWidth, lineCap, clockwise, size } = this.data; const position = size / 2; const radius = position - strokeWidth / 2; context.setStrokeStyle(strokeStyle); @@ -116,13 +123,13 @@ VantComponent({ this.presetCanvas(context, layerColor, 0, PERIMETER, fill); }, renderHoverCircle(context, formatValue) { - const { clockwise, hoverColor } = this.data; + const { clockwise } = this.data; // 结束角度 const progress = PERIMETER * (formatValue / 100); const endAngle = clockwise ? BEGIN_ANGLE + progress : 3 * Math.PI - (BEGIN_ANGLE + progress); - this.presetCanvas(context, hoverColor, BEGIN_ANGLE, endAngle); + this.presetCanvas(context, this.hoverColor, BEGIN_ANGLE, endAngle); }, drawCircle(currentValue) { const { size } = this.data; @@ -165,10 +172,11 @@ VantComponent({ } }, }, - created() { - const { value } = this.data; - this.currentValue = value; - this.drawCircle(value); + mounted() { + this.currentValue = this.data.value; + this.setHoverColor().then(() => { + this.drawCircle(this.currentValue); + }); }, destroyed() { this.clearInterval(); diff --git a/dist/field/index.js b/dist/field/index.js index 5e7d78a3..6bfade57 100644 --- a/dist/field/index.js +++ b/dist/field/index.js @@ -1,9 +1,8 @@ import { VantComponent } from '../common/component'; import { commonProps, inputProps, textareaProps } from './props'; -import { canIUseModel } from '../common/version'; VantComponent({ field: true, - classes: ['input-class', 'right-icon-class'], + classes: ['input-class', 'right-icon-class', 'label-class'], props: Object.assign( Object.assign( Object.assign(Object.assign({}, commonProps), inputProps), @@ -105,9 +104,7 @@ VantComponent({ this.$emit('keyboardheightchange', event.detail); }, emitChange() { - if (canIUseModel()) { - this.setData({ value: this.value }); - } + this.setData({ value: this.value }); wx.nextTick(() => { this.$emit('input', this.value); this.$emit('change', this.value); diff --git a/dist/field/index.wxml b/dist/field/index.wxml index 140f05b7..c984d897 100644 --- a/dist/field/index.wxml +++ b/dist/field/index.wxml @@ -14,6 +14,7 @@ custom-style="{{ customStyle }}" arrow-direction="{{ arrowDirection }}" custom-class="van-field" + title-class="label-class" > diff --git a/dist/grid-item/index.wxss b/dist/grid-item/index.wxss index b7e0301e..ed7facb8 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--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 +@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)}.van-grid-item__icon+.van-grid-item__text{margin-top:8px} \ No newline at end of file diff --git a/dist/nav-bar/index.js b/dist/nav-bar/index.js index afed24e7..b94132fa 100644 --- a/dist/nav-bar/index.js +++ b/dist/nav-bar/index.js @@ -1,4 +1,5 @@ import { VantComponent } from '../common/component'; +import { getSystemInfoSync } from '../common/utils'; VantComponent({ classes: ['title-class'], props: { @@ -34,7 +35,7 @@ VantComponent({ baseStyle: '', }, created() { - const { statusBarHeight } = wx.getSystemInfoSync(); + const { statusBarHeight } = getSystemInfoSync(); const { safeAreaInsetTop, zIndex } = this.data; const paddingTop = safeAreaInsetTop ? statusBarHeight : 0; const baseStyle = `z-index: ${zIndex};padding-top: ${paddingTop}px;`; diff --git a/dist/nav-bar/index.wxml b/dist/nav-bar/index.wxml index 941bf563..27ba8c96 100644 --- a/dist/nav-bar/index.wxml +++ b/dist/nav-bar/index.wxml @@ -4,36 +4,38 @@ - - - + + + + + {{ leftText }} + + + + + {{ title }} + + + {{ leftText }} - - - - - {{ title }} - - - - {{ rightText }} - + >{{ rightText }} + + diff --git a/dist/nav-bar/index.wxss b/dist/nav-bar/index.wxss index 01fd3bd7..a2331281 100644 --- a/dist/nav-bar/index.wxss +++ b/dist/nav-bar/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-nav-bar{position:relative;text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--nav-bar-background-color,#fff)}.van-nav-bar__text{display:inline-block;vertical-align:middle;margin:0 -16px;margin:0 -var(--padding-md,16px);padding:0 16px;padding:0 var(--padding-md,16px);color:#1989fa;color:var(--nav-bar-text-color,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;font-size:16px;font-size:var(--nav-bar-arrow-size,16px);color:#1989fa;color:var(--nav-bar-text-color,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;color:#323233;color:var(--nav-bar-title-text-color,#323233);font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--nav-bar-title-font-size,16px)}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;font-size:14px;font-size:var(--font-size-md,14px)}.van-nav-bar__left{left:16px;left:var(--padding-md,16px)}.van-nav-bar__right{right:16px;right:var(--padding-md,16px)} \ No newline at end of file +@import '../common/index.wxss';.van-nav-bar{text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--nav-bar-background-color,#fff)}.van-nav-bar,.van-nav-bar__content{position:relative}.van-nav-bar__text{display:inline-block;vertical-align:middle;margin:0 -16px;margin:0 -var(--padding-md,16px);padding:0 16px;padding:0 var(--padding-md,16px);color:#1989fa;color:var(--nav-bar-text-color,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;font-size:16px;font-size:var(--nav-bar-arrow-size,16px);color:#1989fa;color:var(--nav-bar-text-color,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;color:#323233;color:var(--nav-bar-title-text-color,#323233);font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--nav-bar-title-font-size,16px)}.van-nav-bar__left,.van-nav-bar__right{position:absolute;top:0;bottom:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;font-size:14px;font-size:var(--font-size-md,14px)}.van-nav-bar__left{left:16px;left:var(--padding-md,16px)}.van-nav-bar__right{right:16px;right:var(--padding-md,16px)} \ No newline at end of file diff --git a/dist/steps/index.wxml b/dist/steps/index.wxml index af31094f..6180b417 100644 --- a/dist/steps/index.wxml +++ b/dist/steps/index.wxml @@ -17,9 +17,9 @@ - + {{ item.message }} - + > + + @@ -57,7 +58,7 @@ wx:if="{{ showUpload }}" class="van-uploader__upload {{ disabled ? 'van-uploader__upload--disabled': ''}}" style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};" - bind:tap="startUpload" + bindtap="startUpload" > {{ uploadText }} diff --git a/dist/uploader/index.wxss b/dist/uploader/index.wxss index da44e472..b1fd9592 100644 --- a/dist/uploader/index.wxss +++ b/dist/uploader/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-uploader{position:relative;display:inline-block}.van-uploader__wrapper{display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap}.van-uploader__slot:empty{display:none}.van-uploader__slot:not(:empty)+.van-uploader__upload{display:none!important}.van-uploader__upload{position:relative;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:80px;height:80px;margin:0 8px 8px 0;background-color:#f7f8fa;border-radius:8px}.van-uploader__upload:active{background-color:#f2f3f5}.van-uploader__upload-icon{color:#dcdee0;font-size:24px}.van-uploader__upload-text{margin-top:8px;color:#969799;font-size:12px}.van-uploader__upload--disabled{opacity:.5;opacity:var(--uploader-disabled-opacity,.5)}.van-uploader__preview{position:relative;margin:0 8px 8px 0;cursor:pointer}.van-uploader__preview-image{display:block;width:80px;height:80px;overflow:hidden;border-radius:8px}.van-uploader__preview-delete{position:absolute;top:-8px;right:-8px;color:#969799;font-size:18px;background-color:#fff;border-radius:100%}.van-uploader__file{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;width:80px;height:80px;background-color:#f7f8fa;border-radius:8px}.van-uploader__file-icon{color:#646566;font-size:20px}.van-uploader__file-name{box-sizing:border-box;width:100%;margin-top:8px;padding:0 4px;color:#646566;font-size:12px;text-align:center}.van-uploader__mask{position:absolute;top:0;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;color:#fff;background-color:rgba(50,50,51,.88);border-radius:8px}.van-uploader__mask-icon{font-size:22px}.van-uploader__mask-message{margin-top:6px;padding:0 4px;font-size:12px;line-height:14px}.van-uploader__loading{width:22px;height:22px;color:#fff} \ No newline at end of file +@import '../common/index.wxss';.van-uploader{position:relative;display:inline-block}.van-uploader__wrapper{display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap}.van-uploader__slot:empty{display:none}.van-uploader__slot:not(:empty)+.van-uploader__upload{display:none!important}.van-uploader__upload{position:relative;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:80px;height:80px;margin:0 8px 8px 0;background-color:#f7f8fa;border-radius:8px}.van-uploader__upload:active{background-color:#f2f3f5}.van-uploader__upload-icon{color:#dcdee0;font-size:24px}.van-uploader__upload-text{margin-top:8px;color:#969799;font-size:12px}.van-uploader__upload--disabled{opacity:.5;opacity:var(--uploader-disabled-opacity,.5)}.van-uploader__preview{position:relative;margin:0 8px 8px 0;cursor:pointer}.van-uploader__preview-image{display:block;width:80px;height:80px;overflow:hidden;border-radius:8px}.van-uploader__preview-delete{position:absolute;top:0;right:0;z-index:1;display:-webkit-flex;display:flex;padding:10px;border-radius:50%;-webkit-transform:translate(50%,-50%);transform:translate(50%,-50%)}.van-uploader__preview-delete__icon{color:#969799;font-size:18px;background-color:#fff;border-radius:50%}.van-uploader__file{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;width:80px;height:80px;background-color:#f7f8fa;border-radius:8px}.van-uploader__file-icon{color:#646566;font-size:20px}.van-uploader__file-name{box-sizing:border-box;width:100%;margin-top:8px;padding:0 4px;color:#646566;font-size:12px;text-align:center}.van-uploader__mask{position:absolute;top:0;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;color:#fff;background-color:rgba(50,50,51,.88);border-radius:8px}.van-uploader__mask-icon{font-size:22px}.van-uploader__mask-message{margin-top:6px;padding:0 4px;font-size:12px;line-height:14px}.van-uploader__loading{width:22px;height:22px;color:#fff} \ No newline at end of file diff --git a/lib/calendar/index.js b/lib/calendar/index.js index 699bbd81..e2b2ce13 100644 --- a/lib/calendar/index.js +++ b/lib/calendar/index.js @@ -167,7 +167,7 @@ component_1.VantComponent({ ]; } if (type === 'multiple') { - return [defaultDate || minDate]; + return defaultDate || [minDate]; } return defaultDate || minDate; }, diff --git a/lib/circle/index.js b/lib/circle/index.js index 296011c8..5c34f803 100644 --- a/lib/circle/index.js +++ b/lib/circle/index.js @@ -41,7 +41,12 @@ component_1.VantComponent({ color: { type: [String, Object], value: color_1.BLUE, - observer: 'setHoverColor', + observer: function () { + var _this = this; + this.setHoverColor().then(function () { + _this.drawCircle(_this.currentValue); + }); + }, }, type: { type: String, @@ -62,7 +67,9 @@ component_1.VantComponent({ methods: { getContext: function () { var _this = this; - var type = this.data.type; + var _a = this.data, + type = _a.type, + size = _a.size; if (type === '') { var ctx = wx.createCanvasContext('van-circle', this); return Promise.resolve(ctx); @@ -72,13 +79,16 @@ component_1.VantComponent({ wx.createSelectorQuery() .in(_this) .select('#van-circle') - .fields({ node: true, size: true }) + .node() .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); + if (!_this.inited) { + _this.inited = true; + canvas.width = size * dpr; + canvas.height = size * dpr; + ctx.scale(dpr, dpr); + } resolve(canvas_1.adaptor(ctx)); }); }); @@ -88,32 +98,31 @@ component_1.VantComponent({ var _a = this.data, color = _a.color, size = _a.size; - var hoverColor = color; - this.getContext().then(function (context) { - if (utils_1.isObj(color)) { - var LinearColor_1 = context.createLinearGradient(size, 0, 0, 0); + if (utils_1.isObj(color)) { + return this.getContext().then(function (context) { + var LinearColor = 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( + return LinearColor.addColorStop( parseFloat(key) / 100, color[key] ); }); - hoverColor = LinearColor_1; - } - _this.setData({ hoverColor: hoverColor }); - }); + _this.hoverColor = LinearColor; + }); + } + this.hoverColor = color; + return Promise.resolve(); }, presetCanvas: function (context, strokeStyle, beginAngle, endAngle, fill) { var _a = this.data, strokeWidth = _a.strokeWidth, lineCap = _a.lineCap, clockwise = _a.clockwise, - size = _a.size, - type = _a.type; + size = _a.size; var position = size / 2; var radius = position - strokeWidth / 2; context.setStrokeStyle(strokeStyle); @@ -134,15 +143,13 @@ component_1.VantComponent({ this.presetCanvas(context, layerColor, 0, PERIMETER, fill); }, renderHoverCircle: function (context, formatValue) { - var _a = this.data, - clockwise = _a.clockwise, - hoverColor = _a.hoverColor; + var clockwise = this.data.clockwise; // 结束角度 var progress = PERIMETER * (formatValue / 100); var endAngle = clockwise ? BEGIN_ANGLE + progress : 3 * Math.PI - (BEGIN_ANGLE + progress); - this.presetCanvas(context, hoverColor, BEGIN_ANGLE, endAngle); + this.presetCanvas(context, this.hoverColor, BEGIN_ANGLE, endAngle); }, drawCircle: function (currentValue) { var _this = this; @@ -189,10 +196,12 @@ component_1.VantComponent({ } }, }, - created: function () { - var value = this.data.value; - this.currentValue = value; - this.drawCircle(value); + mounted: function () { + var _this = this; + this.currentValue = this.data.value; + this.setHoverColor().then(function () { + _this.drawCircle(_this.currentValue); + }); }, destroyed: function () { this.clearInterval(); diff --git a/lib/field/index.js b/lib/field/index.js index d26c164f..764114e5 100644 --- a/lib/field/index.js +++ b/lib/field/index.js @@ -17,10 +17,9 @@ var __assign = Object.defineProperty(exports, '__esModule', { value: true }); var component_1 = require('../common/component'); var props_1 = require('./props'); -var version_1 = require('../common/version'); component_1.VantComponent({ field: true, - classes: ['input-class', 'right-icon-class'], + classes: ['input-class', 'right-icon-class', 'label-class'], props: __assign( __assign( __assign(__assign({}, props_1.commonProps), props_1.inputProps), @@ -126,9 +125,7 @@ component_1.VantComponent({ }, emitChange: function () { var _this = this; - if (version_1.canIUseModel()) { - this.setData({ value: this.value }); - } + this.setData({ value: this.value }); wx.nextTick(function () { _this.$emit('input', _this.value); _this.$emit('change', _this.value); diff --git a/lib/field/index.wxml b/lib/field/index.wxml index 140f05b7..c984d897 100644 --- a/lib/field/index.wxml +++ b/lib/field/index.wxml @@ -14,6 +14,7 @@ custom-style="{{ customStyle }}" arrow-direction="{{ arrowDirection }}" custom-class="van-field" + title-class="label-class" > diff --git a/lib/grid-item/index.wxss b/lib/grid-item/index.wxss index b7e0301e..ed7facb8 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--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 +@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)}.van-grid-item__icon+.van-grid-item__text{margin-top:8px} \ No newline at end of file diff --git a/lib/nav-bar/index.js b/lib/nav-bar/index.js index 2894d294..fb4fd97a 100644 --- a/lib/nav-bar/index.js +++ b/lib/nav-bar/index.js @@ -1,6 +1,7 @@ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var component_1 = require('../common/component'); +var utils_1 = require('../common/utils'); component_1.VantComponent({ classes: ['title-class'], props: { @@ -36,7 +37,7 @@ component_1.VantComponent({ baseStyle: '', }, created: function () { - var statusBarHeight = wx.getSystemInfoSync().statusBarHeight; + var statusBarHeight = utils_1.getSystemInfoSync().statusBarHeight; var _a = this.data, safeAreaInsetTop = _a.safeAreaInsetTop, zIndex = _a.zIndex; diff --git a/lib/nav-bar/index.wxml b/lib/nav-bar/index.wxml index 941bf563..27ba8c96 100644 --- a/lib/nav-bar/index.wxml +++ b/lib/nav-bar/index.wxml @@ -4,36 +4,38 @@ - - - + + + + + {{ leftText }} + + + + + {{ title }} + + + {{ leftText }} - - - - - {{ title }} - - - - {{ rightText }} - + >{{ rightText }} + + diff --git a/lib/nav-bar/index.wxss b/lib/nav-bar/index.wxss index 01fd3bd7..a2331281 100644 --- a/lib/nav-bar/index.wxss +++ b/lib/nav-bar/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-nav-bar{position:relative;text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--nav-bar-background-color,#fff)}.van-nav-bar__text{display:inline-block;vertical-align:middle;margin:0 -16px;margin:0 -var(--padding-md,16px);padding:0 16px;padding:0 var(--padding-md,16px);color:#1989fa;color:var(--nav-bar-text-color,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;font-size:16px;font-size:var(--nav-bar-arrow-size,16px);color:#1989fa;color:var(--nav-bar-text-color,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;color:#323233;color:var(--nav-bar-title-text-color,#323233);font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--nav-bar-title-font-size,16px)}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;font-size:14px;font-size:var(--font-size-md,14px)}.van-nav-bar__left{left:16px;left:var(--padding-md,16px)}.van-nav-bar__right{right:16px;right:var(--padding-md,16px)} \ No newline at end of file +@import '../common/index.wxss';.van-nav-bar{text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--nav-bar-background-color,#fff)}.van-nav-bar,.van-nav-bar__content{position:relative}.van-nav-bar__text{display:inline-block;vertical-align:middle;margin:0 -16px;margin:0 -var(--padding-md,16px);padding:0 16px;padding:0 var(--padding-md,16px);color:#1989fa;color:var(--nav-bar-text-color,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;font-size:16px;font-size:var(--nav-bar-arrow-size,16px);color:#1989fa;color:var(--nav-bar-text-color,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;color:#323233;color:var(--nav-bar-title-text-color,#323233);font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--nav-bar-title-font-size,16px)}.van-nav-bar__left,.van-nav-bar__right{position:absolute;top:0;bottom:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;font-size:14px;font-size:var(--font-size-md,14px)}.van-nav-bar__left{left:16px;left:var(--padding-md,16px)}.van-nav-bar__right{right:16px;right:var(--padding-md,16px)} \ No newline at end of file diff --git a/lib/steps/index.wxml b/lib/steps/index.wxml index af31094f..6180b417 100644 --- a/lib/steps/index.wxml +++ b/lib/steps/index.wxml @@ -17,9 +17,9 @@ - + {{ item.message }} - + > + + @@ -57,7 +58,7 @@ wx:if="{{ showUpload }}" class="van-uploader__upload {{ disabled ? 'van-uploader__upload--disabled': ''}}" style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};" - bind:tap="startUpload" + bindtap="startUpload" > {{ uploadText }} diff --git a/lib/uploader/index.wxss b/lib/uploader/index.wxss index da44e472..b1fd9592 100644 --- a/lib/uploader/index.wxss +++ b/lib/uploader/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-uploader{position:relative;display:inline-block}.van-uploader__wrapper{display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap}.van-uploader__slot:empty{display:none}.van-uploader__slot:not(:empty)+.van-uploader__upload{display:none!important}.van-uploader__upload{position:relative;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:80px;height:80px;margin:0 8px 8px 0;background-color:#f7f8fa;border-radius:8px}.van-uploader__upload:active{background-color:#f2f3f5}.van-uploader__upload-icon{color:#dcdee0;font-size:24px}.van-uploader__upload-text{margin-top:8px;color:#969799;font-size:12px}.van-uploader__upload--disabled{opacity:.5;opacity:var(--uploader-disabled-opacity,.5)}.van-uploader__preview{position:relative;margin:0 8px 8px 0;cursor:pointer}.van-uploader__preview-image{display:block;width:80px;height:80px;overflow:hidden;border-radius:8px}.van-uploader__preview-delete{position:absolute;top:-8px;right:-8px;color:#969799;font-size:18px;background-color:#fff;border-radius:100%}.van-uploader__file{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;width:80px;height:80px;background-color:#f7f8fa;border-radius:8px}.van-uploader__file-icon{color:#646566;font-size:20px}.van-uploader__file-name{box-sizing:border-box;width:100%;margin-top:8px;padding:0 4px;color:#646566;font-size:12px;text-align:center}.van-uploader__mask{position:absolute;top:0;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;color:#fff;background-color:rgba(50,50,51,.88);border-radius:8px}.van-uploader__mask-icon{font-size:22px}.van-uploader__mask-message{margin-top:6px;padding:0 4px;font-size:12px;line-height:14px}.van-uploader__loading{width:22px;height:22px;color:#fff} \ No newline at end of file +@import '../common/index.wxss';.van-uploader{position:relative;display:inline-block}.van-uploader__wrapper{display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap}.van-uploader__slot:empty{display:none}.van-uploader__slot:not(:empty)+.van-uploader__upload{display:none!important}.van-uploader__upload{position:relative;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:80px;height:80px;margin:0 8px 8px 0;background-color:#f7f8fa;border-radius:8px}.van-uploader__upload:active{background-color:#f2f3f5}.van-uploader__upload-icon{color:#dcdee0;font-size:24px}.van-uploader__upload-text{margin-top:8px;color:#969799;font-size:12px}.van-uploader__upload--disabled{opacity:.5;opacity:var(--uploader-disabled-opacity,.5)}.van-uploader__preview{position:relative;margin:0 8px 8px 0;cursor:pointer}.van-uploader__preview-image{display:block;width:80px;height:80px;overflow:hidden;border-radius:8px}.van-uploader__preview-delete{position:absolute;top:0;right:0;z-index:1;display:-webkit-flex;display:flex;padding:10px;border-radius:50%;-webkit-transform:translate(50%,-50%);transform:translate(50%,-50%)}.van-uploader__preview-delete__icon{color:#969799;font-size:18px;background-color:#fff;border-radius:50%}.van-uploader__file{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;width:80px;height:80px;background-color:#f7f8fa;border-radius:8px}.van-uploader__file-icon{color:#646566;font-size:20px}.van-uploader__file-name{box-sizing:border-box;width:100%;margin-top:8px;padding:0 4px;color:#646566;font-size:12px;text-align:center}.van-uploader__mask{position:absolute;top:0;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;color:#fff;background-color:rgba(50,50,51,.88);border-radius:8px}.van-uploader__mask-icon{font-size:22px}.van-uploader__mask-message{margin-top:6px;padding:0 4px;font-size:12px;line-height:14px}.van-uploader__loading{width:22px;height:22px;color:#fff} \ No newline at end of file From b7f4627cbdd60948b15b1f207e6ea264b9cca37f Mon Sep 17 00:00:00 2001 From: rex Date: Wed, 24 Jun 2020 17:08:54 +0800 Subject: [PATCH 030/119] build: release 1.3.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 49da7961..cdf91f32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vant/weapp", - "version": "1.3.2", + "version": "1.3.3", "author": "youzan", "license": "MIT", "miniprogram": "lib", From 11dd8df9d4aa067a0c8a005513bd6a9d1ac27421 Mon Sep 17 00:00:00 2001 From: rex Date: Wed, 24 Jun 2020 17:34:36 +0800 Subject: [PATCH 031/119] docs(changelog): release 1.3.3 --- docs/markdown/changelog.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/markdown/changelog.md b/docs/markdown/changelog.md index 5a62d558..120e852c 100644 --- a/docs/markdown/changelog.md +++ b/docs/markdown/changelog.md @@ -1,5 +1,24 @@ # 更新日志 +### [v1.3.3](https://github.com/youzan/vant-weapp/tree/v1.3.3) +`2020-06-24` + +**Features** + +- steps: 为每一项增加 inactiveIcon、activeIcon 属性 [\#3315](https://github.com/youzan/vant-weapp/pull/3315) +- field: 增加外部样式类 label-class [\#3311](https://github.com/youzan/vant-weapp/pull/3311) +- field: 现在总会从内部 set value 值 [\#3313](https://github.com/youzan/vant-weapp/pull/3313) +- uploader: 为每一项增加 deletable 属性 [\#3270](https://github.com/youzan/vant-weapp/pull/3270) +- uploader: 扩大删除图标的可点击区域 [\#3265](https://github.com/youzan/vant-weapp/pull/3265) + +**Bug Fixes** + +- tabbar: 修复 iphone-se 上高度异常 [\#3314](https://github.com/youzan/vant-weapp/pull/3314) +- grid: 修复 text 与 icon 同时设置时样式异常 [\#3310](https://github.com/youzan/vant-weapp/pull/3310) +- calendar: 修复多选模式下 default-date 属性不生效 [\#3284](https://github.com/youzan/vant-weapp/pull/3284) +- circle: 修复 type="2d" 时无法动态变更 value [\#3264](https://github.com/youzan/vant-weapp/pull/3264) +- nav-bar: 修复未设置 left-text 时左侧图标样式异常 [\#3263](https://github.com/youzan/vant-weapp/pull/3263) + ### [v1.3.2](https://github.com/youzan/vant-weapp/tree/v1.3.2) `2020-06-04` From b4cfcceca81c90f5878a6e32c277f400845a125d Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 24 Jun 2020 17:38:15 +0800 Subject: [PATCH 032/119] feat(Picker): update action button style (#3316) --- packages/common/style/var.less | 5 +++-- packages/picker/index.less | 16 +++++++++++----- packages/picker/toolbar.wxml | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/packages/common/style/var.less b/packages/common/style/var.less index 88655283..a909d6ea 100644 --- a/packages/common/style/var.less +++ b/packages/common/style/var.less @@ -27,6 +27,7 @@ @disabled-opacity: 0.5; @background-color: @gray-1; @background-color-light: #fafafa; +@text-link-color: #576b95; // Padding @padding-base: 4px; @@ -328,8 +329,8 @@ @picker-title-font-size: @font-size-lg; @picker-action-padding: 0 @padding-md; @picker-action-font-size: @font-size-md; -@picker-action-text-color: @blue; -@picker-action-active-color: @active-color; +@picker-confirm-action-color: @text-link-color; +@picker-cancel-action-color: @gray-6; @picker-option-font-size: @font-size-lg; @picker-option-text-color: @black; @picker-loading-icon-color: @blue; diff --git a/packages/picker/index.less b/packages/picker/index.less index a500197a..efe78241 100644 --- a/packages/picker/index.less +++ b/packages/picker/index.less @@ -19,13 +19,20 @@ &__confirm { .theme(padding, '@picker-action-padding'); .theme(font-size, '@picker-action-font-size'); - .theme(color, '@picker-action-text-color'); &--hover { - .theme(background-color, '@picker-action-active-color'); + opacity: @active-opacity; } } + &__confirm { + .theme(color, '@picker-confirm-action-color'); + } + + &__cancel { + .theme(color, '@picker-cancel-action-color'); + } + &__title { max-width: 50%; text-align: center; @@ -75,13 +82,12 @@ pointer-events: none; } - &__loading .van-loading, &__frame { position: absolute; top: 50%; - left: 0; + right: @padding-md; + left: @padding-md; z-index: 1; - width: 100%; transform: translateY(-50%); pointer-events: none; } diff --git a/packages/picker/toolbar.wxml b/packages/picker/toolbar.wxml index 4fa9db50..e41a7301 100644 --- a/packages/picker/toolbar.wxml +++ b/packages/picker/toolbar.wxml @@ -1,7 +1,7 @@