修改页面
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>
标签:axios,http,9090,家庭,item,记账,NoteUpdate,data From: https://www.cnblogs.com/daniel350-wang/p/18036618