get请求和post请求 的2种方式
// 1.发送get请求 axios.get(`http://123.207.32.32:9001/lyric?id=500665346`).then(res => { console.log("res:", res.data.lrc) }) axios.get("http://123.207.32.32:9001/lyric", { params: { id: 500665346 } }).then(res => { console.log("res:", res.data.lrc) }) // 2.发送post请求 axios.post("http://123.207.32.32:1888/02_param/postjson", { name: "coderwhy", password: 123456 }).then(res => { console.log("res", res.data) }) axios.post("http://123.207.32.32:1888/02_param/postjson", { data: { name: "coderwhy", password: 123456 } }).then(res => { console.log("res", res.data) })
本文来自博客园,作者:杨建鑫,转载请注明原文链接:https://www.cnblogs.com/qd-lbxx/p/16635362.html