import http from './http/index'
Vue.use(http);
//import {http} from './http/index'
//Vue.prototype.$http=http;
import axios from 'axios'
export const http=async function(){
function But(){
return new Promise((resolve,reject)=>{
// resolve({a:1,b:2})
// reject({err:500})
const data={
params:{
a:"132"
}
}
const header={
header:{
"Contene-Type":"application/json"
}
}
//application/x-www-form-urlencoded
axios.get("http://localhost:8000/tp5/publica/index/Http/index",data,header).then(
(res)=>{resolve(res)}
).catch(()=>{
(res)=>{reject(res)}
})
})
}
return await But();
}
const install=function(Vue,options){
Vue.prototype.$http=async function(){
function But(){
return new Promise((resolve,reject)=>{
// resolve({a:1,b:2})
// reject({err:500})
const data={
params:{
a:"132"
}
}
const header={
header:{
"Contene-Type":"application/json"
}
}
//application/x-www-form-urlencoded
axios.get("http://localhost:8000/tp5/publica/index/Http/index",data,header).then(
(res)=>{resolve(res)}
).catch(()=>{
(res)=>{reject(res)}
})
})
}
return await But();
}
}
export default{
install//用于結合vue.use()
}