为了账号安全,请及时绑定邮箱和手机立即绑定

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++
    },

正在回答

1 回答

你确定你的reg方法执行了吗?

有没有debug过?

这里可以这么样赋值啊!

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

vue methods中的方法无法给data中的变量赋值

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信