mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore(Collapse): improve warning (#8119)
This commit is contained in:
parent
708d57ea77
commit
faab7c03f0
@ -41,15 +41,19 @@ export default createComponent({
|
|||||||
const isExpanded = (name) => {
|
const isExpanded = (name) => {
|
||||||
const { accordion, modelValue } = props;
|
const { accordion, modelValue } = props;
|
||||||
|
|
||||||
if (
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
!accordion &&
|
if (accordion && Array.isArray(modelValue)) {
|
||||||
!Array.isArray(modelValue) &&
|
console.error(
|
||||||
process.env.NODE_ENV !== 'production'
|
'[Vant] Collapse: "v-model" should not be Array in accordion mode'
|
||||||
) {
|
);
|
||||||
console.error(
|
return false;
|
||||||
'[Vant] Collapse: type of prop "modelValue" should be Array'
|
}
|
||||||
);
|
if (!accordion && !Array.isArray(modelValue)) {
|
||||||
return;
|
console.error(
|
||||||
|
'[Vant] Collapse: "v-model" should be Array in non-accordion mode'
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return accordion ? modelValue === name : modelValue.indexOf(name) !== -1;
|
return accordion ? modelValue === name : modelValue.indexOf(name) !== -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user