src/views/login.vue
@@ -46,12 +46,16 @@ } } }, created: function() { sessionStorage.removeItem('store'); }, methods: { handleSubmit(name) { this.$refs[name].validate((valid) => { if (valid) { this.$store.commit('setLogin', true); this.$store.commit('setUserName', this.user.name); sessionStorage.setItem("store",JSON.stringify(this.$store.state)) this.$router.push('/index'); } else { this.$Message.error('登录失败!用户名/密码错误');