2.2

修改页面

NoteUpdate.vue

复制代码
<template>
  <div>
    <el-form ref="form" :model="item" label-width="80px">
  <el-form-item label="金额">
    <el-input v-model="item.money"></el-input>
  </el-form-item>
  <el-form-item label="备注">
    <el-input v-model="item.msg"></el-input>
  </el-form-item>
  <el-form-item label="日期">
    <el-input v-model="item.date"></el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="update">立即修改</el-button>
  </el-form-item>
</el-form>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    name:'NoteUpdate',
    data() {
        return {
            item:'',
        }
    },
    methods:{
        async getData(){
            var res=await axios.get('http://localhost:9090/note/'+this.$route.query.id)
            this.item=res.data.data
        },
        async update(){
            await axios.put('http://localhost:9090/note',this.item)
            this.$router.push('/home')
        }
    },
    created(){
        this.getData()
    }
}
</script>

<style>

</style>
 
posted @ 2024-03-01 13:53  chrisrmas、  阅读(7)  评论(0编辑  收藏  举报