vue3如何将异步获取的后端返回值在前端页面显示?-灵析社区

无情编码机器

methods: {async searchLocation() { try { const response = await axios.get('http://localhost:29999/selectLocationByNumber/'+this.inputValue); console.log(response.data); this.number = response.data.number; this.location = response.data.location; } catch (error) { // 处理请求错误 console.error('Error fetching data:', error); } },} export default {data() { return {number:'', location:'',} }} {{ number }} {{ location }} 异步方法向后端发送请求,得到返回值response,number和location在页面上显示不出来?不会vue

阅读量:17

点赞量:0

问AI
刘传疯子
""不是这么用的 给你文档,你自己看下 "http://element-plus.org/zh-CN/component/table.html#%E5%9F%BA%..." (https://link.segmentfault.com/?enc=uhzg1zSmIwhnaZvpe8gkJw%3D%3D.6iXEcGD%2BQngLb1r17zbfrnBGystTvW7K%2FTyEYn%2FuORUUcPpcVB1JKdEznq0l9xZmr0q5caaXyYjbjP3FxYNTnLFA4Re3My62OPqMZmIxdDis45SB0wpxe1ba5zZXMUzK)