vue向beego后端发送数据

Login.vue:

<script>
export default {
     
  data() {
     
    return {
     
      login_form: {
     
          accountNumber:"" ,
          password:""
      }
    };
  },
  methods: {
     

    login(){
     
          this.$http.post('http://localhost:8080/login', this.login_form, 
          {
      headers: {
     'content-type':'application/json'} }) 
          .then(function (response)
              {
      console.log(response); })
          .catch(function (error) 
              {
      console.log(error); });
    },


    handleClick(tab, event) {
     
      console.log(tab, event);
    },
    register() {
     
      this.$router.push("/register")
    },
  },
};
</script>

main.js


axios.defaults.baseURL = 'http://localhost:8080/'
Vue.prototype.$http = axios

Vue.config.productionTip = false

new Vue({
     
  router,
  store,
  render: h => h(App)
}).$mount('#app')

你可能感兴趣的:(javascript)