vue-axios删除操作

<template>
  <div class="nav">
    <input v-model="location" type="text" />
    <input @click="Deletes()" value="删除" type="button" />
    <h4 v-if="font === 4">成功</h4>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "DeleteView",
  data() {
    return {
      location: "",
      font: [],
    };
  },

  methods: {
    Deletes() {
      axios({
        // 请求方式
        method: "GET",
        // 请求地址
        url: `http://localhost:8086/Deletes`,
        // URL中的查询参数
        params: {
          location: this.location,
        },
      }).then((sta) => {
        console.log(sta);
        this.font = 4;
      });
    },
  },
};
</script>

<style>
label {
  font-size: 20px;
  font-weight: 700;
}

.navs {
  margin-top: 10px;
}
.nav {
  border-top: 3px solid #ff8500;
  background-color: #fcfcfc;
  border-bottom: 1px solid #edeeed;
  line-height: 41px;
}
.nav a {
  display: inline-block;
  height: 41px;
  padding: 0px 10px;
  font-size: 15px;
  color: #4c4c4c;
  font-family: "微软雅黑";
  text-decoration: none;
}
.nav a:hover {
  background: #edeeed;
  color: #ff8500;
}
</style>

 

posted @ 2022-10-31 20:41  しゅおく  阅读(71)  评论(0)    收藏  举报