vue methods中的方法無(wú)法給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('用戶名或者密碼錯(cuò)誤') ????????} ????}, ????reg:?function?()?{ ????????this.isReg?=?true//賦值無(wú)效 ????????this.count++ ????},
2019-10-08
你確定你的reg方法執(zhí)行了嗎?
有沒(méi)有debug過(guò)?
這里可以這么樣賦值啊!