1、安装axios
npm install axios --save-dev
2、main.js中全局引入
import axios from 'axios' const app = createApp(App) app.config.globalProperties.$http = axios3、页面引用,通过formdata方式请求
import { getCurrentInstance } from 'vue'; const { proxy } = getCurrentInstance() proxy.$http({ method: 'post', url: 'url地址', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, data: JSON.stringify({words:word}) }).then((response)=>{ console.log(response) })通过json请求
get
proxy.$http.get('/a?id=1').then(response => { console.log( response.data) })post
proxy.$http.post('/a', { "id": 5, "name": "bfw" }).then(response => { console.log(response.data) }, error => { console.log('错误', error.message) })
网友回复
阿里通义大模型哪些是支持多模态的api的ai模型?
js如何实现浏览器中离线语音唤醒语音聊天小助手?
浏览器中如何将WebM视频转成mp4视频?
parlant如何改成qwen 的apikey与baseurl?
如何写一个chrome插件实现截屏自动生成步骤图文教程转成pdf或网页?
python如何通过阿里云的api对域名进行解析和ecs主机服务器进行启动停止等操作?
Tesla Robotaxi可以让特斯拉车自动无人驾驶跑滴滴为车主赚钱,国内以后也会这样吗?
有没有可以监控安卓手机上的app打开后偷偷摸摸做了啥的监控软件?
webrtc进行p2p连接发送的文本音视频文件是否是加密的?
如何让一个可爱的三维动物通过three在浏览器中有表情动作的自然说话?