vant/packages/collapse/index.vue
2018-11-15 15:30:17 +08:00

40 lines
629 B
Vue

<template>
<div
:class="b()"
class="van-hairline--top-bottom"
>
<slot />
</div>
</template>
<script>
import create from '../utils/create';
export default create({
name: 'collapse',
props: {
accordion: Boolean,
value: [String, Number, Array]
},
data() {
return {
items: []
};
},
methods: {
switch(name, expanded) {
if (!this.accordion) {
name = expanded
? this.value.concat(name)
: this.value.filter(activeName => activeName !== name);
}
this.$emit('change', name);
this.$emit('input', name);
}
}
});
</script>