axios发送post请求,如何提交表单数据?

var app = new Vue({
    
    el: "#register",
    
    data: {
        registerUrl: "/KindlePocket/bindingData"
        newUserInfo: {
            userName:'n',
            phone:'13',
            email:'12',
            emailPwd:'22',
            kindleEmail:'asd'
        }
    },
    
    methods: {
        register: function() {
            
                axios.post(this.registerUrl, this.newUserInfo, {
                      headers: {
                            'Content-Type': 'application/x-www-form-urlencoded'
                      }
                  })
                  .then(function (response) {
                    console.log(response);
                  })
                  .catch(function (error) {
                    console.log(error);
                  });
            
        }
    }
})
posted @ 2017-09-06 14:50  lyls  阅读(7969)  评论(0编辑  收藏  举报