Compare commits

...

3 Commits

Author SHA1 Message Date
neverland
6128434e22
chore: extract validateModelValue (#8807) 2021-06-03 21:48:36 +08:00
dependabot[bot]
0c71982db9
build(deps): bump ws from 6.2.1 to 6.2.2 (#8806)
Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-03 19:08:07 +08:00
dependabot[bot]
42bd72f5a6
build(deps): bump ws from 6.2.1 to 6.2.2 in /packages/vant-cli (#8805)
Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-03 19:07:54 +08:00
3 changed files with 33 additions and 22 deletions

View File

@ -2342,8 +2342,8 @@ async-each@^1.0.1:
async-limiter@~1.0.0:
version "1.0.1"
resolved "https://registry.npm.taobao.org/async-limiter/download/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"
integrity sha1-3TeelPDbgxCwgpH51kwyCXZmF/0=
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"
integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==
async-retry@1.3.1:
version "1.3.1"
@ -10717,9 +10717,9 @@ write-file-atomic@^3.0.0, write-file-atomic@^3.0.3:
typedarray-to-buffer "^3.1.5"
ws@^6.2.1:
version "6.2.1"
resolved "https://registry.npm.taobao.org/ws/download/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb"
integrity sha1-RC/fCkftZPWbal2P8TD0dI7VJPs=
version "6.2.2"
resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.2.tgz#dd5cdbd57a9979916097652d78f1cc5faea0c32e"
integrity sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==
dependencies:
async-limiter "~1.0.0"

View File

@ -12,6 +12,25 @@ export type CollapseProvide = {
isExpanded: (name: number | string) => boolean;
};
function validateModelValue(
modelValue: string | number | Array<string | number>,
accordion: boolean
) {
if (accordion && Array.isArray(modelValue)) {
console.error(
'[Vant] Collapse: "v-model" should not be Array in accordion mode'
);
return false;
}
if (!accordion && !Array.isArray(modelValue)) {
console.error(
'[Vant] Collapse: "v-model" should be Array in non-accordion mode'
);
return false;
}
return true;
}
export default defineComponent({
name,
@ -55,19 +74,11 @@ export default defineComponent({
const isExpanded = (name: number | string) => {
const { accordion, modelValue } = props;
if (process.env.NODE_ENV !== 'production') {
if (accordion && Array.isArray(modelValue)) {
console.error(
'[Vant] Collapse: "v-model" should not be Array in accordion mode'
);
return false;
}
if (!accordion && !Array.isArray(modelValue)) {
console.error(
'[Vant] Collapse: "v-model" should be Array in non-accordion mode'
);
return false;
}
if (
process.env.NODE_ENV !== 'production' &&
!validateModelValue(modelValue, accordion)
) {
return false;
}
return accordion

View File

@ -2518,7 +2518,7 @@ async-each@^1.0.1:
async-limiter@~1.0.0:
version "1.0.1"
resolved "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"
integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==
async-retry@1.3.1:
@ -11043,9 +11043,9 @@ write-file-atomic@^3.0.0, write-file-atomic@^3.0.3:
typedarray-to-buffer "^3.1.5"
ws@^6.2.1:
version "6.2.1"
resolved "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb"
integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==
version "6.2.2"
resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.2.tgz#dd5cdbd57a9979916097652d78f1cc5faea0c32e"
integrity sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==
dependencies:
async-limiter "~1.0.0"