vue methods中的方法無法給data中的變量賦值
data()?{ ????return?{ ????????count:?0, ????????isReg:?false, ????????name:?'', ????????password:?'', ????????repeat:?'' ????} }, methods:?{ ????login:?function?()?{ ????????if?(localStorage.getItem('name')?==?this.name?&&?localStorage.getItem('password')?==?this.password)?{ ????????????this.$router.push('/home') ????????}?else?{ ????????????alert('用戶名或者密碼錯誤') ????????} ????}, ????reg:?function?()?{ ????????this.isReg?=?true//賦值無效 ????????this.count++ ????},
2019-10-08
你確定你的reg方法執行了嗎?
有沒有debug過?
這里可以這么樣賦值??!