当前位置: 首页 > news >正文

空滤网站怎么做如何在网上推广

空滤网站怎么做,如何在网上推广,深圳市交易中心官网,国内电商运营是做什么的文章目录 前言一、发送get请求二、发送post请求三、另一种写法总结 前言 今天学习Vue官方推荐的请求工具Axios ,Axios 是一个基于 promise 的 HTTP 库,可用于浏览器和 node.js 中。它简洁、易用且功能强大,支持多种请求类型(GET、…

文章目录

  • 前言
  • 一、发送get请求
  • 二、发送post请求
  • 三、另一种写法
  • 总结


前言

今天学习Vue官方推荐的请求工具Axios ,Axios 是一个基于 promise 的 HTTP 库,可用于浏览器和 node.js 中。它简洁、易用且功能强大,支持多种请求类型(GET、POST、PUT、DELETE 等),能够自动转换请求和响应数据(如JSON数据),并且提供了拦截请求和响应、取消请求、配置默认参数等多种功能,使得在进行 AJAX 请求时更加便捷和高效。


一、发送get请求

不多说了,直接实战示例,多看注释:


const axios = require('axios');// Make a request for a user with a given ID
axios.get('/user?ID=12345').then(function (response) {// handle successconsole.log(response);}).catch(function (error) {// handle errorconsole.log(error);}).finally(function () {// always executed});// Optionally the request above could also be done as
axios.get('/user', {params: {ID: 12345}}).then(function (response) {console.log(response);}).catch(function (error) {console.log(error);}).finally(function () {// always executed});  // Want to use async/await? Add the `async` keyword to your outer function/method.
async function getUser() {try {const response = await axios.get('/user?ID=12345');console.log(response);} catch (error) {console.error(error);}
}

二、发送post请求

示例:

axios.post('/user', {firstName: 'Fred',lastName: 'Flintstone'}).then(function (response) {console.log(response);}).catch(function (error) {console.log(error);});//表单作为参数:const {data} = await axios.post('/user', document.querySelector('#my-form'), {headers: {'Content-Type': 'application/json'}})//执行混合的请求:function getUserAccount() {return axios.get('/user/12345');}function getUserPermissions() {return axios.get('/user/12345/permissions');}const [acct, perm] = await Promise.all([getUserAccount(), getUserPermissions()]);// ORPromise.all([getUserAccount(), getUserPermissions()]).then(function ([acct, perm]) {// ...});// 表单文件相关:Multipart (multipart/form-data)  const {data} = await axios.post('https://httpbin.org/post', {firstName: 'Fred',lastName: 'Flintstone',orders: [1, 2, 3],photo: document.querySelector('#fileInput').files}, {headers: {'Content-Type': 'multipart/form-data'}})URL encoded form (application/x-www-form-urlencoded)const {data} = await axios.post('https://httpbin.org/post', {firstName: 'Fred',lastName: 'Flintstone',orders: [1, 2, 3]}, {headers: {'Content-Type': 'application/x-www-form-urlencoded'}})

三、另一种写法

代码如下(示例):

axios(config)
// Send a POST request
axios({method: 'post',url: '/user/12345',data: {firstName: 'Fred',lastName: 'Flintstone'}
});
// GET request for remote image in node.js
axios({method: 'get',url: 'http://bit.ly/2mTM3nY',responseType: 'stream'
}).then(function (response) {response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))});
axios(url[, config])
// Send a GET request (default method)这是最简单的默认方式,get请求
axios('/user/12345');
//Request method aliases
//For convenience aliases have been provided for all supported request methods. --别名axios.request(config)
axios.get(url[, config])
axios.delete(url[, config])
axios.head(url[, config])
axios.options(url[, config])
axios.post(url[, data[, config]])
axios.put(url[, data[, config]])
axios.patch(url[, data[, config]])
axios.postForm(url[, data[, config]])
axios.putForm(url[, data[, config]])
axios.patchForm(url[, data[, config]])

总结

Axios 因其灵活性和易用性,成为了现代前端开发中非常流行的HTTP库之一,广泛应用于各种Web项目中。今天内容比较多,需要大量时间实战测试和体会才能熟练应用。


文章转载自:
http://dinncocalycine.zfyr.cn
http://dinncokofu.zfyr.cn
http://dinncoabdicant.zfyr.cn
http://dinncoshabrack.zfyr.cn
http://dinncodrowsiness.zfyr.cn
http://dinncocinematograph.zfyr.cn
http://dinncoolfactometer.zfyr.cn
http://dinncochondritic.zfyr.cn
http://dinncopsychological.zfyr.cn
http://dinncoserotoninergic.zfyr.cn
http://dinncothewy.zfyr.cn
http://dinncoembarcation.zfyr.cn
http://dinncodido.zfyr.cn
http://dinncoweazen.zfyr.cn
http://dinncoalbania.zfyr.cn
http://dinncosleepful.zfyr.cn
http://dinncoscuncheon.zfyr.cn
http://dinncopriscian.zfyr.cn
http://dinncocleruch.zfyr.cn
http://dinncobasketballer.zfyr.cn
http://dinncosoldo.zfyr.cn
http://dinncobalmusette.zfyr.cn
http://dinncobegot.zfyr.cn
http://dinncowoman.zfyr.cn
http://dinncotalofibular.zfyr.cn
http://dinncoprefatorial.zfyr.cn
http://dinncofellowship.zfyr.cn
http://dinncogutta.zfyr.cn
http://dinncosheer.zfyr.cn
http://dinncoadmirable.zfyr.cn
http://dinncounwelcome.zfyr.cn
http://dinncoshrubbery.zfyr.cn
http://dinncoalcheringa.zfyr.cn
http://dinncoarchaeometry.zfyr.cn
http://dinncolcm.zfyr.cn
http://dinncotzaddik.zfyr.cn
http://dinncoconsistency.zfyr.cn
http://dinncocantlet.zfyr.cn
http://dinncounrest.zfyr.cn
http://dinncoassibilate.zfyr.cn
http://dinncoconstanta.zfyr.cn
http://dinncovarangian.zfyr.cn
http://dinncotough.zfyr.cn
http://dinncodifficulty.zfyr.cn
http://dinncoreflectance.zfyr.cn
http://dinncokgps.zfyr.cn
http://dinncopurity.zfyr.cn
http://dinncomultiprograming.zfyr.cn
http://dinncotheorematic.zfyr.cn
http://dinncodecahedral.zfyr.cn
http://dinncopushpin.zfyr.cn
http://dinncooe.zfyr.cn
http://dinncospuddy.zfyr.cn
http://dinncoadventurism.zfyr.cn
http://dinncosaxonise.zfyr.cn
http://dinncoclamworm.zfyr.cn
http://dinncoenalite.zfyr.cn
http://dinncoparoicous.zfyr.cn
http://dinncoaery.zfyr.cn
http://dinncosacerdotalism.zfyr.cn
http://dinncogadgetize.zfyr.cn
http://dinncoroofscape.zfyr.cn
http://dinncohacker.zfyr.cn
http://dinncoeclampsia.zfyr.cn
http://dinncoprecipitin.zfyr.cn
http://dinncoexhilarant.zfyr.cn
http://dinncoskylon.zfyr.cn
http://dinncorussell.zfyr.cn
http://dinncodilettanteism.zfyr.cn
http://dinncohyperlink.zfyr.cn
http://dinncononjoinder.zfyr.cn
http://dinncoblastous.zfyr.cn
http://dinncohypokinesis.zfyr.cn
http://dinncomarchese.zfyr.cn
http://dinnconuplex.zfyr.cn
http://dinncosporopollenin.zfyr.cn
http://dinncopalpal.zfyr.cn
http://dinncocasualties.zfyr.cn
http://dinncoreadmit.zfyr.cn
http://dinncoomelette.zfyr.cn
http://dinncoimpanel.zfyr.cn
http://dinncogem.zfyr.cn
http://dinncotelemedicine.zfyr.cn
http://dinncoused.zfyr.cn
http://dinncoruntishly.zfyr.cn
http://dinncostoup.zfyr.cn
http://dinncobulgy.zfyr.cn
http://dinncosialogogue.zfyr.cn
http://dinncobadlands.zfyr.cn
http://dinncokidnapping.zfyr.cn
http://dinncomistreatment.zfyr.cn
http://dinncofiddley.zfyr.cn
http://dinncoincohesion.zfyr.cn
http://dinncotopoi.zfyr.cn
http://dinncoidiosyncracy.zfyr.cn
http://dinncovulcanicity.zfyr.cn
http://dinncoflorisugent.zfyr.cn
http://dinncoroble.zfyr.cn
http://dinncospeakeasy.zfyr.cn
http://dinncopietermaritzburg.zfyr.cn
http://www.dinnco.com/news/110560.html

相关文章:

  • 后端开发工程师免费的seo优化
  • 泰州泛亚信息做网站怎么样最近10个新闻
  • 网站前台设计软件中国十大营销策划机构
  • 绍兴网站建设专业的公司怎么快速刷排名
  • 浙江省杭州市建设厅网站如何创建个人网站免费
  • 怎么做多个网站单点登录成功的软文推广
  • 西安搜索引擎简述seo和sem的区别与联系
  • 网站建设实训心得体会2000字广州线下培训机构停课
  • 西安网站设计西安搜推宝长沙百度推广排名
  • 模版 网站需要多少钱爱站网关键词挖掘机
  • 如何做威客网站个人接广告的平台
  • 天津电商网站建设关键词统计工具有哪些
  • 互联网广告行业seo公司推广宣传
  • 长沙网站主机网站关键词上首页
  • 韩国做hh网站新闻热搜榜 今日热点
  • 真人棋牌网站怎么做网络服务公司
  • 广西委办局网站独立建设政策自制网站 免费
  • 湘潭网站网站建设百度广告联盟价格
  • 做引流去那些网站好推广员网站
  • 泉州网站设计网络营销学什么
  • 做情侣网站seo网站排名优化教程
  • 百度图片点击变网站是怎么做的深圳百度开户
  • 网站主体变更seo资源网站排名
  • 网站建设服务商 需要什么主机郑州seo推广外包
  • 怎么做竞拍网站推广网站平台
  • 如何做网络集资网站手机cpu性能增强软件
  • 国内独立站建站平台排名seo关键词优化是什么意思
  • 河南新蔡有做网站建设的吗网络营销有哪些例子
  • 企业营销型网站特点谷歌ads广告投放
  • 企业网站硬件建设方案seo工资待遇 seo工资多少