From cd439c04f305e323865e87940266c7764ade1731 Mon Sep 17 00:00:00 2001 From: Fengyuan Chen Date: Mon, 5 Sep 2022 23:30:46 +0800 Subject: [PATCH 1/7] fix(utils): avoid getting unexpected value (#11010) For example, when calling `get({}, 'button.small')`, it expects to return an empty string, but return a function (`''.small` is a native function, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/small). --- packages/vant/src/utils/basic.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vant/src/utils/basic.ts b/packages/vant/src/utils/basic.ts index 51093d73e..c280e6bc1 100644 --- a/packages/vant/src/utils/basic.ts +++ b/packages/vant/src/utils/basic.ts @@ -1,3 +1,4 @@ +import { isObject } from './validate'; import type { ComponentPublicInstance } from 'vue'; export function noop() {} @@ -16,7 +17,7 @@ export function get(object: any, path: string): any { let result = object; keys.forEach((key) => { - result = result[key] ?? ''; + result = isObject(result) ? result[key] ?? '' : ''; }); return result; From 830a1eb5cfb3c4409950f814abde166415189969 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 6 Sep 2022 00:00:28 +0800 Subject: [PATCH 2/7] fix(@vant/cli): failed to build types of sfc (#11012) --- packages/vant-cli/src/compiler/compile-sfc.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/vant-cli/src/compiler/compile-sfc.ts b/packages/vant-cli/src/compiler/compile-sfc.ts index 71304f652..6c3acd0ff 100644 --- a/packages/vant-cli/src/compiler/compile-sfc.ts +++ b/packages/vant-cli/src/compiler/compile-sfc.ts @@ -87,11 +87,6 @@ export async function compileSfc(filePath: string): Promise { new Promise((resolve) => { let script = ''; - // the generated render fn lacks type definitions - if (lang === 'ts') { - script += '// @ts-nocheck\n'; - } - let bindingMetadata; if (descriptor.scriptSetup) { const { bindings, content } = compileScript(descriptor, { @@ -125,6 +120,12 @@ export async function compileSfc(filePath: string): Promise { script += `\n${EXPORT} ${VUEIDS}`; + // ts-nocheck should be placed on the first line + // the generated render fn lacks type definitions + if (lang === 'ts') { + script = '// @ts-nocheck\n' + script; + } + outputFile(scriptFilePath, script).then(resolve); }) ); From f0d3e04fba4ecb05d7893d290d48089e860e3ee6 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Tue, 6 Sep 2022 00:01:50 +0800 Subject: [PATCH 3/7] release: @vant/cli 4.0.4 --- packages/vant-cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vant-cli/package.json b/packages/vant-cli/package.json index de14a37ef..35f17e93d 100644 --- a/packages/vant-cli/package.json +++ b/packages/vant-cli/package.json @@ -1,6 +1,6 @@ { "name": "@vant/cli", - "version": "4.0.3", + "version": "4.0.4", "type": "module", "main": "lib/index.js", "typings": "lib/index.d.ts", From 1b08f84ac6dc84cb3cea93f7816a4fcd5f5c2293 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Tue, 6 Sep 2022 00:02:32 +0800 Subject: [PATCH 4/7] docs(changelog): @vant/cli 4.0.4 --- packages/vant-cli/changelog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/vant-cli/changelog.md b/packages/vant-cli/changelog.md index 6239f3c36..066b5a836 100644 --- a/packages/vant-cli/changelog.md +++ b/packages/vant-cli/changelog.md @@ -31,6 +31,12 @@ yarn add stylelint@13 @vant/stylelint-config 现在会默认生成 WebStorm 所需的 web-types.json 文件到 `lib/web-types.json` 目录下。 +## v4.0.4 + +`2022-07-02` + +- 修复构建 sfc 文件的类型定义时报错的问题 + ## v4.0.3 `2022-07-02` From 6f910c9913b01c79e31ab01985bb4de4df9550dd Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 7 Sep 2022 23:20:28 +0800 Subject: [PATCH 5/7] feat(Dialog): message-align can be justify (#11014) --- packages/vant/src/dialog/README.md | 2 +- packages/vant/src/dialog/README.zh-CN.md | 2 +- packages/vant/src/dialog/index.less | 4 ++++ packages/vant/src/dialog/types.ts | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/vant/src/dialog/README.md b/packages/vant/src/dialog/README.md index fae78a536..6ca83b7a9 100644 --- a/packages/vant/src/dialog/README.md +++ b/packages/vant/src/dialog/README.md @@ -177,7 +177,7 @@ export default { | title | Title | _string_ | - | | width | Width | _number \| string_ | `320px` | | message | Message | _string \| () => JSX.ELement_ | - | -| message-align | Message align, can be set to `left` `right` | _string_ | `center` | +| message-align | Message align, can be set to `left` `right` `justify` | _string_ | `center` | | theme | Theme style, can be set to `round-button` | _string_ | `default` | | show-confirm-button | Whether to show confirm button | _boolean_ | `true` | | show-cancel-button | Whether to show cancel button | _boolean_ | `false` | diff --git a/packages/vant/src/dialog/README.zh-CN.md b/packages/vant/src/dialog/README.zh-CN.md index 82521e8ad..39ffc99e6 100644 --- a/packages/vant/src/dialog/README.zh-CN.md +++ b/packages/vant/src/dialog/README.zh-CN.md @@ -235,7 +235,7 @@ export default { | title | 标题 | _string_ | - | | width | 弹窗宽度,默认单位为 `px` | _number \| string_ | `320px` | | message | 文本内容,支持通过 `\n` 换行 | _string \| () => JSX.Element_ | - | -| message-align | 内容水平对齐方式,可选值为 `left` `right` | _string_ | `center` | +| message-align | 内容水平对齐方式,可选值为 `left` `right` `justify` | _string_ | `center` | | theme | 样式风格,可选值为 `round-button` | _string_ | `default` | | show-confirm-button | 是否展示确认按钮 | _boolean_ | `true` | | show-cancel-button | 是否展示取消按钮 | _boolean_ | `false` | diff --git a/packages/vant/src/dialog/index.less b/packages/vant/src/dialog/index.less index e8db2cb3c..74bd2e174 100644 --- a/packages/vant/src/dialog/index.less +++ b/packages/vant/src/dialog/index.less @@ -83,6 +83,10 @@ &--right { text-align: right; } + + &--justify { + text-align: justify; + } } &__footer { diff --git a/packages/vant/src/dialog/types.ts b/packages/vant/src/dialog/types.ts index 46db56343..bcfc9d8c6 100644 --- a/packages/vant/src/dialog/types.ts +++ b/packages/vant/src/dialog/types.ts @@ -5,7 +5,7 @@ import type { Interceptor, Numeric } from '../utils'; export type DialogTheme = 'default' | 'round-button'; export type DialogAction = 'confirm' | 'cancel'; export type DialogMessage = string | (() => JSX.Element); -export type DialogMessageAlign = 'left' | 'center' | 'right'; +export type DialogMessageAlign = 'left' | 'center' | 'right' | 'justify'; export type DialogOptions = { title?: string; From 69d3ba000c455fd5bdfe12f16914589e6c63807e Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 10 Sep 2022 12:46:55 +0800 Subject: [PATCH 6/7] chore: bump pnpm version to 7.11 (#11021) --- .npmrc | 2 + package.json | 2 +- .../vant/docs/markdown/contribution.zh-CN.md | 10 +++- pnpm-lock.yaml | 54 +++++++++---------- 4 files changed, 38 insertions(+), 30 deletions(-) diff --git a/.npmrc b/.npmrc index 5e4086a7f..7fb5ac34e 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,3 @@ registry=https://registry.npmmirror.com/ + +strict-peer-dependencies=false diff --git a/package.json b/package.json index c81ff7fea..c91f4cb69 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "*.{ts,tsx,js,vue,less}": "prettier --write", "*.{ts,tsx,js,vue}": "eslint --fix" }, - "packageManager": "pnpm@7.1.6", + "packageManager": "pnpm@7.11.0", "devDependencies": { "@vant/cli": "workspace:*", "@vant/eslint-config": "workspace:*", diff --git a/packages/vant/docs/markdown/contribution.zh-CN.md b/packages/vant/docs/markdown/contribution.zh-CN.md index 4eebb8c03..e9f2d2705 100644 --- a/packages/vant/docs/markdown/contribution.zh-CN.md +++ b/packages/vant/docs/markdown/contribution.zh-CN.md @@ -4,7 +4,7 @@ 感谢你使用 Vant。 -以下是关于向 Vant 提交反馈或代码的指南。在向 Vant 提交 issue 或者 PR 之前,请先花几分钟时间阅读以下文字。 +以下是关于向 Vant 提交反馈或代码的指南。在向 Vant 提交 issue 或者 PR 之前,请先花几分钟时间阅读以下内容。 ### Issue 规范 @@ -15,7 +15,7 @@ ### 本地开发 -在进行本地开发前,请先确保你的开发环境中安装了 [Node.js >= 14](https://nodejs.org) 和 [pnpm](https://pnpm.io). +在进行本地开发前,请先确保你的开发环境中安装了 [Node.js >= 14.19.0](https://nodejs.org)。 按照下面的步骤操作,即可在本地开发 Vant 组件。 @@ -23,6 +23,12 @@ # 克隆仓库 git clone git@github.com:vant-ui/vant.git +# 启用 pnpm 包管理器 +corepack enable + +# 如果无法使用 corepack,你也可以手动安装 pnpm +npm install -g pnpm@7 + # 安装依赖 pnpm i diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5f3ac045a..b33675889 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: 5.3 +lockfileVersion: 5.4 importers: @@ -136,7 +136,7 @@ importers: '@babel/core': 7.18.13 '@babel/preset-typescript': 7.18.6_@babel+core@7.18.13 '@docsearch/css': 3.2.1 - '@docsearch/js': 3.2.1_react-dom@18.2.0+react@18.2.0 + '@docsearch/js': 3.2.1_biqbaboplfbrettd7655fr4n2y '@types/jest': 27.5.2 '@vant/eslint-config': link:../vant-eslint-config '@vant/touch-emulator': link:../vant-touch-emulator @@ -160,7 +160,7 @@ importers: jest-serializer-html: 7.1.0 less: 4.1.3 markdown-it: 12.3.2 - markdown-it-anchor: 8.6.4_d643ca6eb40ae68ab966a77bead78073 + markdown-it-anchor: 8.6.4_2zb4u3vubltivolgu556vv4aom nano-staged: 0.8.0 nanospinner: 1.1.0 picocolors: 1.0.0 @@ -195,11 +195,11 @@ importers: eslint-plugin-vue: ^9.4.0 typescript: ^4.8.2 dependencies: - '@typescript-eslint/eslint-plugin': 5.36.1_586c56b3bc76dec8ef0f241fb0cda488 - '@typescript-eslint/parser': 5.36.1_eslint@8.23.0+typescript@4.8.2 - eslint-config-airbnb-base: 15.0.0_281cc4e22b3419695ab0c330ccaae282 + '@typescript-eslint/eslint-plugin': 5.36.1_lbwfnm54o3pmr3ypeqp3btnera + '@typescript-eslint/parser': 5.36.1_yqf6kl63nyoq5megxukfnom5rm + eslint-config-airbnb-base: 15.0.0_faomjyrlgqmwswvqymymzkxcqi eslint-config-prettier: 8.5.0_eslint@8.23.0 - eslint-plugin-import: 2.26.0_b62f4c66ab291fb5cb0e4045c2ba4587 + eslint-plugin-import: 2.26.0_wyxuyzvlfep3lsyoibc4fosfq4 eslint-plugin-vue: 9.4.0_eslint@8.23.0 devDependencies: enhanced-resolve: 5.10.0 @@ -898,10 +898,10 @@ packages: resolution: {integrity: sha512-gaP6TxxwQC+K8D6TRx5WULUWKrcbzECOPA2KCVMuI+6C7dNiGUk5yXXzVhc5sld79XKYLnO9DRTI4mjXDYkh+g==} dev: false - /@docsearch/js/3.2.1_react-dom@18.2.0+react@18.2.0: + /@docsearch/js/3.2.1_biqbaboplfbrettd7655fr4n2y: resolution: {integrity: sha512-H1PekEtSeS0msetR2YGGey2w7jQ2wAKfGODJvQTygSwMgUZ+2DHpzUgeDyEBIXRIfaBcoQneqrzsljM62pm6Xg==} dependencies: - '@docsearch/react': 3.2.1_react-dom@18.2.0+react@18.2.0 + '@docsearch/react': 3.2.1_biqbaboplfbrettd7655fr4n2y preact: 10.8.2 transitivePeerDependencies: - '@algolia/client-search' @@ -910,7 +910,7 @@ packages: - react-dom dev: false - /@docsearch/react/3.2.1_react-dom@18.2.0+react@18.2.0: + /@docsearch/react/3.2.1_biqbaboplfbrettd7655fr4n2y: resolution: {integrity: sha512-EzTQ/y82s14IQC5XVestiK/kFFMe2aagoYFuTAIfIb/e+4FU7kSMKonRtLwsCiLQHmjvNQq+HO+33giJ5YVtaQ==} peerDependencies: '@types/react': '>= 16.8.0 < 19.0.0' @@ -1565,7 +1565,7 @@ packages: dependencies: '@types/yargs-parser': 21.0.0 - /@typescript-eslint/eslint-plugin/5.36.1_586c56b3bc76dec8ef0f241fb0cda488: + /@typescript-eslint/eslint-plugin/5.36.1_lbwfnm54o3pmr3ypeqp3btnera: resolution: {integrity: sha512-iC40UK8q1tMepSDwiLbTbMXKDxzNy+4TfPWgIL661Ym0sD42vRcQU93IsZIrmi+x292DBr60UI/gSwfdVYexCA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -1576,10 +1576,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.36.1_eslint@8.23.0+typescript@4.8.2 + '@typescript-eslint/parser': 5.36.1_yqf6kl63nyoq5megxukfnom5rm '@typescript-eslint/scope-manager': 5.36.1 - '@typescript-eslint/type-utils': 5.36.1_eslint@8.23.0+typescript@4.8.2 - '@typescript-eslint/utils': 5.36.1_eslint@8.23.0+typescript@4.8.2 + '@typescript-eslint/type-utils': 5.36.1_yqf6kl63nyoq5megxukfnom5rm + '@typescript-eslint/utils': 5.36.1_yqf6kl63nyoq5megxukfnom5rm debug: 4.3.4 eslint: 8.23.0 functional-red-black-tree: 1.0.1 @@ -1592,7 +1592,7 @@ packages: - supports-color dev: false - /@typescript-eslint/parser/5.36.1_eslint@8.23.0+typescript@4.8.2: + /@typescript-eslint/parser/5.36.1_yqf6kl63nyoq5megxukfnom5rm: resolution: {integrity: sha512-/IsgNGOkBi7CuDfUbwt1eOqUXF9WGVBW9dwEe1pi+L32XrTsZIgmDFIi2RxjzsvB/8i+MIf5JIoTEH8LOZ368A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -1620,7 +1620,7 @@ packages: '@typescript-eslint/visitor-keys': 5.36.1 dev: false - /@typescript-eslint/type-utils/5.36.1_eslint@8.23.0+typescript@4.8.2: + /@typescript-eslint/type-utils/5.36.1_yqf6kl63nyoq5megxukfnom5rm: resolution: {integrity: sha512-xfZhfmoQT6m3lmlqDvDzv9TiCYdw22cdj06xY0obSznBsT///GK5IEZQdGliXpAOaRL34o8phEvXzEo/VJx13Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -1631,7 +1631,7 @@ packages: optional: true dependencies: '@typescript-eslint/typescript-estree': 5.36.1_typescript@4.8.2 - '@typescript-eslint/utils': 5.36.1_eslint@8.23.0+typescript@4.8.2 + '@typescript-eslint/utils': 5.36.1_yqf6kl63nyoq5megxukfnom5rm debug: 4.3.4 eslint: 8.23.0 tsutils: 3.21.0_typescript@4.8.2 @@ -1666,7 +1666,7 @@ packages: - supports-color dev: false - /@typescript-eslint/utils/5.36.1_eslint@8.23.0+typescript@4.8.2: + /@typescript-eslint/utils/5.36.1_yqf6kl63nyoq5megxukfnom5rm: resolution: {integrity: sha512-lNj4FtTiXm5c+u0pUehozaUWhh7UYKnwryku0nxJlYUEWetyG92uw2pr+2Iy4M/u0ONMKzfrx7AsGBTCzORmIg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2599,8 +2599,8 @@ packages: engines: {node: '>=10'} hasBin: true dependencies: - is-text-path: 1.0.1 JSONStream: 1.3.5 + is-text-path: 1.0.1 lodash: 4.17.21 meow: 8.1.2 split2: 3.2.2 @@ -3272,7 +3272,7 @@ packages: source-map: 0.6.1 dev: false - /eslint-config-airbnb-base/15.0.0_281cc4e22b3419695ab0c330ccaae282: + /eslint-config-airbnb-base/15.0.0_faomjyrlgqmwswvqymymzkxcqi: resolution: {integrity: sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==} engines: {node: ^10.12.0 || >=12.0.0} peerDependencies: @@ -3281,7 +3281,7 @@ packages: dependencies: confusing-browser-globals: 1.0.11 eslint: 8.23.0 - eslint-plugin-import: 2.26.0_b62f4c66ab291fb5cb0e4045c2ba4587 + eslint-plugin-import: 2.26.0_wyxuyzvlfep3lsyoibc4fosfq4 object.assign: 4.1.2 object.entries: 1.1.5 semver: 6.3.0 @@ -3305,7 +3305,7 @@ packages: - supports-color dev: false - /eslint-module-utils/2.7.3_f6f598d58d3bd4640126d6600a4285f5: + /eslint-module-utils/2.7.3_632zrvmnhpkgiajg2zqauquf6u: resolution: {integrity: sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==} engines: {node: '>=4'} peerDependencies: @@ -3323,7 +3323,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.36.1_eslint@8.23.0+typescript@4.8.2 + '@typescript-eslint/parser': 5.36.1_yqf6kl63nyoq5megxukfnom5rm debug: 3.2.7 eslint-import-resolver-node: 0.3.6 find-up: 2.1.0 @@ -3331,7 +3331,7 @@ packages: - supports-color dev: false - /eslint-plugin-import/2.26.0_b62f4c66ab291fb5cb0e4045c2ba4587: + /eslint-plugin-import/2.26.0_wyxuyzvlfep3lsyoibc4fosfq4: resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==} engines: {node: '>=4'} peerDependencies: @@ -3341,14 +3341,14 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.36.1_eslint@8.23.0+typescript@4.8.2 + '@typescript-eslint/parser': 5.36.1_yqf6kl63nyoq5megxukfnom5rm array-includes: 3.1.5 array.prototype.flat: 1.3.0 debug: 2.6.9 doctrine: 2.1.0 eslint: 8.23.0 eslint-import-resolver-node: 0.3.6 - eslint-module-utils: 2.7.3_f6f598d58d3bd4640126d6600a4285f5 + eslint-module-utils: 2.7.3_632zrvmnhpkgiajg2zqauquf6u has: 1.0.3 is-core-module: 2.9.0 is-glob: 4.0.3 @@ -5337,7 +5337,7 @@ packages: engines: {node: '>=8'} dev: false - /markdown-it-anchor/8.6.4_d643ca6eb40ae68ab966a77bead78073: + /markdown-it-anchor/8.6.4_2zb4u3vubltivolgu556vv4aom: resolution: {integrity: sha512-Ul4YVYZNxMJYALpKtu+ZRdrryYt/GlQ5CK+4l1bp/gWXOG2QWElt6AqF3Mih/wfUKdZbNAZVXGR73/n6U/8img==} peerDependencies: '@types/markdown-it': '*' From 0e55b72200f510d1332f55b3b79a304dacae6479 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 10 Sep 2022 17:13:14 +0800 Subject: [PATCH 7/7] feat(Image): add block prop (#11022) --- packages/vant/package.json | 1 + packages/vant/src/image/Image.tsx | 6 +++++- packages/vant/src/image/README.md | 1 + packages/vant/src/image/README.zh-CN.md | 1 + packages/vant/src/image/index.less | 4 ++++ pnpm-lock.yaml | 10 ++-------- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/vant/package.json b/packages/vant/package.json index 4bc2fe75d..1ea1f1719 100644 --- a/packages/vant/package.json +++ b/packages/vant/package.json @@ -53,6 +53,7 @@ }, "devDependencies": { "@types/node": "^16.11.56", + "@types/jest": "^27.0.0", "@vant/area-data": "workspace:*", "@vant/cli": "workspace:*", "@vant/eslint-config": "workspace:*", diff --git a/packages/vant/src/image/Image.tsx b/packages/vant/src/image/Image.tsx index e01305657..dcf62494c 100644 --- a/packages/vant/src/image/Image.tsx +++ b/packages/vant/src/image/Image.tsx @@ -44,6 +44,7 @@ const imageProps = { fit: String as PropType, position: String as PropType, round: Boolean, + block: Boolean, width: numericProp, height: numericProp, radius: numericProp, @@ -191,7 +192,10 @@ export default defineComponent({ } return () => ( -
+
{renderImage()} {renderPlaceholder()} {slots.default?.()} diff --git a/packages/vant/src/image/README.md b/packages/vant/src/image/README.md index 7364d9871..1312e9178 100644 --- a/packages/vant/src/image/README.md +++ b/packages/vant/src/image/README.md @@ -101,6 +101,7 @@ app.use(Lazyload); | height | Height | _number \| string_ | - | | radius | Border Radius | _number \| string_ | `0` | | round | Whether to be round | _boolean_ | `false` | +| block `3.6.3` | Whether the root node is a block element | _boolean_ | `false` | | lazy-load | Whether to enable lazy load, should register [Lazyload](#/en-US/lazyload) component | _boolean_ | `false` | | show-error | Whether to show error placeholder | _boolean_ | `true` | | show-loading | Whether to show loading placeholder | _boolean_ | `true` | diff --git a/packages/vant/src/image/README.zh-CN.md b/packages/vant/src/image/README.zh-CN.md index 461f18ab6..a2e858e7c 100644 --- a/packages/vant/src/image/README.zh-CN.md +++ b/packages/vant/src/image/README.zh-CN.md @@ -127,6 +127,7 @@ app.use(Lazyload); | height | 高度,默认单位为 `px` | _number \| string_ | - | | radius | 圆角大小,默认单位为 `px` | _number \| string_ | `0` | | round | 是否显示为圆形 | _boolean_ | `false` | +| block `3.6.3` | 是否将根节点设置为块级元素,默认情况下为 `inline-block` 元素 | _boolean_ | `false` | | lazy-load | 是否开启图片懒加载,须配合 [Lazyload](#/zh-CN/lazyload) 组件使用 | _boolean_ | `false` | | show-error | 是否展示图片加载失败提示 | _boolean_ | `true` | | show-loading | 是否展示图片加载中提示 | _boolean_ | `true` | diff --git a/packages/vant/src/image/index.less b/packages/vant/src/image/index.less index b0a41aaf2..aac2164eb 100644 --- a/packages/vant/src/image/index.less +++ b/packages/vant/src/image/index.less @@ -23,6 +23,10 @@ } } + &--block { + display: block; + } + &__img, &__error, &__loading { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b33675889..26ac92d54 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,6 +45,7 @@ importers: packages/vant: specifiers: + '@types/jest': ^27.0.0 '@types/node': ^16.11.56 '@vant/area-data': workspace:* '@vant/cli': workspace:* @@ -62,6 +63,7 @@ importers: '@vant/popperjs': link:../vant-popperjs '@vant/use': link:../vant-use devDependencies: + '@types/jest': 27.5.2 '@types/node': 16.11.56 '@vant/area-data': link:../vant-area-data '@vant/cli': link:../vant-cli @@ -1486,7 +1488,6 @@ packages: dependencies: jest-matcher-utils: 27.5.1 pretty-format: 27.5.1 - dev: false /@types/json-buffer/3.0.0: resolution: {integrity: sha512-3YP80IxxFJB4b5tYC2SUPwkg0XQLiu0nWvhRgEatgjf+29IcWO9X1k8xRv5DGssJ/lCrjYTjQPcobJr2yWIVuQ==} @@ -1951,7 +1952,6 @@ packages: /ansi-styles/5.2.0: resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} engines: {node: '>=10'} - dev: false /ansi-styles/6.1.0: resolution: {integrity: sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==} @@ -2820,7 +2820,6 @@ packages: /diff-sequences/27.5.1: resolution: {integrity: sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dev: false /diffable-html/4.1.0: resolution: {integrity: sha512-++kyNek+YBLH8cLXS+iTj/Hiy2s5qkRJEJ8kgu/WHbFrVY2vz9xPFUT+fii2zGF0m1CaojDlQJjkfrCt7YWM1g==} @@ -4659,7 +4658,6 @@ packages: diff-sequences: 27.5.1 jest-get-type: 27.5.1 pretty-format: 27.5.1 - dev: false /jest-docblock/27.5.1: resolution: {integrity: sha512-rl7hlABeTsRYxKiUfpHrQrG4e2obOiTQWfMEH3PxPjOtdsfLQO4ReWSZaQ7DETm4xu07rl4q/h4zcKXyU0/OzQ==} @@ -4712,7 +4710,6 @@ packages: /jest-get-type/27.5.1: resolution: {integrity: sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dev: false /jest-haste-map/27.5.1: resolution: {integrity: sha512-7GgkZ4Fw4NFbMSDSpZwXeBiIbx+t/46nJ2QitkOjvwPYyZmqttu2TDSimMHP1EkPOi4xUZAN1doE5Vd25H4Jng==} @@ -4775,7 +4772,6 @@ packages: jest-diff: 27.5.1 jest-get-type: 27.5.1 pretty-format: 27.5.1 - dev: false /jest-message-util/27.5.1: resolution: {integrity: sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==} @@ -6018,7 +6014,6 @@ packages: ansi-regex: 5.0.1 ansi-styles: 5.2.0 react-is: 17.0.2 - dev: false /process-nextick-args/2.0.1: resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} @@ -6141,7 +6136,6 @@ packages: /react-is/17.0.2: resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} - dev: false /react/18.2.0: resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==}