如何做汽车团购网站,学做馒头面包哪个网站好,自贡网站设计,知道ip怎么查域名非常详细的axios axios
基础操作#xff1a;
请求方式#xff1a;
get方法接收的是params#xff0c;post接收的是data
两种格式#xff1a;
//发送get请求axios.get(地址#xff0c;{params:{ 参数}}).then((res){成功的回调})//发送post请求
axios({method: …非常详细的axios axios
基础操作
请求方式
get方法接收的是paramspost接收的是data
两种格式
//发送get请求axios.get(地址{params:{ 参数}}).then((res){成功的回调})//发送post请求
axios({method: post, //请求方式默认是get请求url:/user/12345, //地址data:{ //参数firstName: simon,lastName: li}
}).then((res){成功的回调}) 创建实列
const base axios.create({// 基础路径baseURL: http://localhost:3000}
)
export const classify (params) {return base({ method: get, url: /dj/recommend/type, params })
}
跨域
//vue里写
axios.get(/api, {params: {tf_id: TFM00R0_261,page: this.num,size: 10,},}).then((res) {this.list this.list.concat(res.data.result)console.log(this.list)}).finally},//vue.config.js中写文件要放在全局
module.exports {// 设置打包后的根路径publicPath: ./,// 关闭代码校验lintOnSave: false,// 关闭源码映射文件productionSourceMap: false,devServer: {// 自动打开文件open: true,proxy: {/api: {target: https://apiv2.pinduoduo.com/api/gindex/tf/query_tf_goods_info,changeOrigin: true, // 允许跨域pathRewrite: {// 替换地址栏^/api: }}}}
}
图片地址不完整
public 文件夹中找index.html,在head中加一句代码
meta namereferrer contentno-referrer
之后在src中用字符串相加的形式补全地址