Commit ad74efbc83bcc7f2e7777e5e282b896356fad328

Authored by zhigang.li
1 parent 2ec84333

fixed the bug about v-modle

Showing 1 changed file with 9 additions and 5 deletions   Show diff stats
src/components/layout/sider.vue
... ... @@ -115,8 +115,8 @@
115 115 methods: {
116 116 toggleCollapse () {
117 117 this.isCollapsed = this.collapsible ? !this.isCollapsed : false;
118   - this.$emit('input', !this.isCollapsed);
119   - this.$emit('on-collapse', !this.isCollapsed);
  118 + this.$emit('input', this.isCollapsed);
  119 + this.$emit('on-collapse', this.isCollapsed);
120 120 },
121 121 matchMedia () {
122 122 let matchMedia;
... ... @@ -137,12 +137,16 @@
137 137 }
138 138 },
139 139 mounted () {
140   - on(window, 'resize', this.onWindowResize);
141   - this.matchMedia();
142   - this.$emit('input', this.defaultCollapsed);
143 140 if (this.defaultCollapsed) {
144 141 this.isCollapsed = true;
  142 + this.$emit('input', this.defaultCollapsed);
  143 + } else {
  144 + if (this.value !== undefined) {
  145 + this.isCollapsed = this.value;
  146 + }
145 147 }
  148 + on(window, 'resize', this.onWindowResize);
  149 + this.matchMedia();
146 150 },
147 151 destroyed () {
148 152 off(window, 'resize', this.onWindowResize);
... ...