账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    this调用问题
    48
    0
    var add = { template: "<div class='re-box'><div><span>姓名</span><input type='text' id='name' v-model='name'/></div>"+ "<div><span>月份</span><input type='number' id='month' v-model='month'/></div>"+ "<div><span>成交数</span><input type='number' id='dones' v-model='dones'/></div>"+ "<div><span>成交量</span><input type='number' id='doneCount' v-model='doneCount'/></div>"+ "<button id='add' @click='add'>提交</button></div>", data:function() { return { name:"", month:null, dones:null, doneCount:null } }, methods:{ add:function() { if(this.name == "" || this.month == null || dones == null || doneCount == null) { alert("内容不能为空"); return; } Vue.http.post(baseUrl+"/add/"+this.name+"/"+this.month+"/"+this.dones+"/"+this.doneCount).then(function(res){ var mes = res.body; if(mes == "exist") { alert("数据已存在"); } else if(mes == "success") { alert("提交成功"); alert(this.name); } },function(res){ console.log(res.status); }); } }};then方法以外的this调用正常,为什么then里面的this调用就不对呢?
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 二更半 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部