mirror of
https://gitee.com/vant-contrib/vant.git
synced 2026-04-30 02:18:15 +08:00
Compare commits
3 Commits
3c527cd8d3
...
6128434e22
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6128434e22 | ||
|
|
0c71982db9 | ||
|
|
42bd72f5a6 |
@ -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"
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user