flat: jsonp

This commit is contained in:
Apcallover
2024-04-15 15:30:10 +08:00
parent f99816be2a
commit 687047f7d7
4 changed files with 31 additions and 9 deletions

View File

@@ -3,15 +3,30 @@ import {
} from '@/untils/AxiosUtils.js';
/*逆地址解析*/
export const getcoder = (location, key, get_poi) => {
return request({
url: 'https://apis.map.qq.com/ws/geocoder/v1',
method: 'get',
params: {
return new Promise((resolve, reject) => {
const paramsData = {
location,
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
// }
// })
}
/*关键词输入提示*/

View File

@@ -4,7 +4,9 @@ import App from './App'
import util from './untils/func.js'
import uView from '@/uni_modules/uview-ui'
import config from './config';
import {
VueJsonp
} from 'vue-jsonp'
// 注册全局组件
// import MescrollBody from "@/components/mescroll-uni/mescroll-body.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('cs-button', CSButton)
Vue.component('empty', empty)
Vue.prototype.$api = {
msg
}
Vue.prototype.$config = config
Vue.prototype.navTo = navTo
Vue.config.productionTip = false
Vue.use(VueJsonp)
Vue.use(util)
Vue.use(uView)

5
package-lock.json generated
View File

@@ -18,6 +18,11 @@
"version": "0.7.3",
"resolved": "https://r.cnpmjs.org/js-md5/download/js-md5-0.7.3.tgz",
"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=="
}
}
}

View File

@@ -19,6 +19,7 @@
"dependencies": {
"decimal.js": "^10.2.0",
"js-base64": "^2.4.9",
"js-md5": "^0.7.3"
"js-md5": "^0.7.3",
"vue-jsonp": "^2.0.0"
}
}