Vue

※前提条件:本文基于 Vue 2.0 创作

create [edit]

axios.create()是添加了自定义配置的新的axios

axios({
	method:'POST',
	url:'http://localhost:8080/login',
	data
})

优点

  1. 可以简化路径写法
  2. 当基础路径发生变化时方便修改,有利于维护
cosnt instance = axios.create({
    baseURL:'http://localhost:8081/' //路径
})

instance({
	url: '/login',
    method: 'POST',
    data: res
})

コメント:



(画像の文字列を入力して下さい)

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS