首页 > 其他分享 >vue-axios增加操作

vue-axios增加操作

时间:2022-10-31 14:35:40浏览次数:69  
标签:Insert axios name vue location 操作 data

<template>
  <div class="Insert">
    <label for="name">名称:</label><input v-model="name" type="text" />
    <label for="location">部门:</label><input v-model="location" type="text" />
    <br />
    <input value="增加" @click="Insert()" type="button" />
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "LoginView",
  data() {
    return {
      name: "",
      location: "",
    };
  },
  methods: {
    Insert() {
      axios({
        // 请求方式/
        method: "POST",

        // 请求地址
        url: "http://localhost:8086/Insert",

        data: {
          name: this.name,
          location: this.location,
        },
        // URL中的查询参数
      }).then(function (result) {
        //处理响应结果
      });
    },
  },
};
</script>

 

标签:Insert,axios,name,vue,location,操作,data
From: https://www.cnblogs.com/ZhuAo/p/16844152.html

相关文章