flat: jsonp
This commit is contained in:
25
api/map.js
25
api/map.js
@@ -3,15 +3,30 @@ import {
|
|||||||
} from '@/untils/AxiosUtils.js';
|
} from '@/untils/AxiosUtils.js';
|
||||||
/*逆地址解析*/
|
/*逆地址解析*/
|
||||||
export const getcoder = (location, key, get_poi) => {
|
export const getcoder = (location, key, get_poi) => {
|
||||||
return request({
|
return new Promise((resolve, reject) => {
|
||||||
url: 'https://apis.map.qq.com/ws/geocoder/v1',
|
const paramsData = {
|
||||||
method: 'get',
|
|
||||||
params: {
|
|
||||||
location,
|
location,
|
||||||
key,
|
key,
|
||||||
get_poi
|
get_poi,
|
||||||
|
output: 'jsonp'
|
||||||
}
|
}
|
||||||
|
jsonp('https://apis.map.qq.com/ws/geocoder/v1', paramsData, 30000)
|
||||||
|
.then((response) => {
|
||||||
|
console.log('response', response)
|
||||||
|
resolve(response)
|
||||||
|
}).catch(err => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
// return request({
|
||||||
|
// url: 'https://apis.map.qq.com/ws/geocoder/v1',
|
||||||
|
// method: 'get',
|
||||||
|
// params: {
|
||||||
|
// location,
|
||||||
|
// key,
|
||||||
|
// get_poi
|
||||||
|
// }
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
/*关键词输入提示*/
|
/*关键词输入提示*/
|
||||||
|
|||||||
7
main.js
7
main.js
@@ -4,7 +4,9 @@ import App from './App'
|
|||||||
import util from './untils/func.js'
|
import util from './untils/func.js'
|
||||||
import uView from '@/uni_modules/uview-ui'
|
import uView from '@/uni_modules/uview-ui'
|
||||||
import config from './config';
|
import config from './config';
|
||||||
|
import {
|
||||||
|
VueJsonp
|
||||||
|
} from 'vue-jsonp'
|
||||||
// 注册全局组件
|
// 注册全局组件
|
||||||
// import MescrollBody from "@/components/mescroll-uni/mescroll-body.vue"
|
// import MescrollBody from "@/components/mescroll-uni/mescroll-body.vue"
|
||||||
// import MescrollUni from "@/components/mescroll-uni/mescroll-uni.vue"
|
// import MescrollUni from "@/components/mescroll-uni/mescroll-uni.vue"
|
||||||
@@ -42,14 +44,13 @@ Vue.component('jl-form', JlForm)
|
|||||||
Vue.component('jl-form-item', JlFormItem)
|
Vue.component('jl-form-item', JlFormItem)
|
||||||
Vue.component('cs-button', CSButton)
|
Vue.component('cs-button', CSButton)
|
||||||
Vue.component('empty', empty)
|
Vue.component('empty', empty)
|
||||||
|
|
||||||
Vue.prototype.$api = {
|
Vue.prototype.$api = {
|
||||||
msg
|
msg
|
||||||
}
|
}
|
||||||
Vue.prototype.$config = config
|
Vue.prototype.$config = config
|
||||||
Vue.prototype.navTo = navTo
|
Vue.prototype.navTo = navTo
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
Vue.use(VueJsonp)
|
||||||
Vue.use(util)
|
Vue.use(util)
|
||||||
Vue.use(uView)
|
Vue.use(uView)
|
||||||
|
|
||||||
|
|||||||
5
package-lock.json
generated
5
package-lock.json
generated
@@ -18,6 +18,11 @@
|
|||||||
"version": "0.7.3",
|
"version": "0.7.3",
|
||||||
"resolved": "https://r.cnpmjs.org/js-md5/download/js-md5-0.7.3.tgz",
|
"resolved": "https://r.cnpmjs.org/js-md5/download/js-md5-0.7.3.tgz",
|
||||||
"integrity": "sha1-tPL7sLMnRV9ZjWcn447Ccs0Jw/I="
|
"integrity": "sha1-tPL7sLMnRV9ZjWcn447Ccs0Jw/I="
|
||||||
|
},
|
||||||
|
"vue-jsonp": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/vue-jsonp/-/vue-jsonp-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-Mzd9GNeuKP5hHFDWZNMWOsCuMILSkA6jo2l4A02wheFz3qqBzH7aSEFTey1BRCZCLizlaf1EqJ5YUtF392KspA=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"decimal.js": "^10.2.0",
|
"decimal.js": "^10.2.0",
|
||||||
"js-base64": "^2.4.9",
|
"js-base64": "^2.4.9",
|
||||||
"js-md5": "^0.7.3"
|
"js-md5": "^0.7.3",
|
||||||
|
"vue-jsonp": "^2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user