From ad74efbc83bcc7f2e7777e5e282b896356fad328 Mon Sep 17 00:00:00 2001
From: zhigang.li <zhigang.li@tendcloud.com>
Date: Wed, 20 Dec 2017 17:32:08 +0800
Subject: [PATCH] fixed the bug about v-modle

---
 src/components/layout/sider.vue | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/components/layout/sider.vue b/src/components/layout/sider.vue
index 6771708..e35df6c 100644
--- a/src/components/layout/sider.vue
+++ b/src/components/layout/sider.vue
@@ -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);
--
libgit2 0.21.4