mirror of
https://github.com/youzan/vant.git
synced 2025-10-18 01:17:15 +00:00
[Improvement] optimize find parent mixin (#781)
This commit is contained in:
@@ -10,13 +10,9 @@ import create from '../utils/create';
|
||||
export default create({
|
||||
name: 'collapse',
|
||||
|
||||
model: {
|
||||
prop: 'activeNames'
|
||||
},
|
||||
|
||||
props: {
|
||||
accordion: Boolean,
|
||||
activeNames: [String, Number, Array]
|
||||
value: [String, Number, Array]
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -27,11 +23,10 @@ export default create({
|
||||
|
||||
methods: {
|
||||
switch(name, expanded) {
|
||||
const { activeNames } = this;
|
||||
if (!this.accordion) {
|
||||
name = expanded
|
||||
? activeNames.concat(name)
|
||||
: activeNames.filter(activeName => activeName !== name);
|
||||
? this.value.concat(name)
|
||||
: this.value.filter(activeName => activeName !== name);
|
||||
}
|
||||
this.$emit('change', name);
|
||||
this.$emit('input', name);
|
||||
|
Reference in New Issue
Block a user