fixed the bug about v-modle

This commit is contained in:
zhigang.li 2017-12-20 17:32:08 +08:00
parent 2ec8433350
commit ad74efbc83

View file

@ -115,8 +115,8 @@
methods: {
toggleCollapse () {
this.isCollapsed = this.collapsible ? !this.isCollapsed : false;
this.$emit('input', !this.isCollapsed);
this.$emit('on-collapse', !this.isCollapsed);
this.$emit('input', this.isCollapsed);
this.$emit('on-collapse', this.isCollapsed);
},
matchMedia () {
let matchMedia;
@ -137,12 +137,16 @@
}
},
mounted () {
on(window, 'resize', this.onWindowResize);
this.matchMedia();
this.$emit('input', this.defaultCollapsed);
if (this.defaultCollapsed) {
this.isCollapsed = true;
this.$emit('input', this.defaultCollapsed);
} else {
if (this.value !== undefined) {
this.isCollapsed = this.value;
}
}
on(window, 'resize', this.onWindowResize);
this.matchMedia();
},
destroyed () {
off(window, 'resize', this.onWindowResize);