当前位置:网站首页>JS 将对象拆开拼接成 URL
JS 将对象拆开拼接成 URL
2022-08-09 02:22:00 【_格鲁特宝宝】
let url = "https://apis.map.qq.com/uri/v1/routeplan?"
let data = {
referer: 'CQPBZ-QRWCU-2RGVJ-44CGR-5WCY6-WVB5Q',
};
data.type = "drive"
data.from = "我的位置"
data.fromcoord = "我的位置经纬度"
data.to = "目的地"
data.tocoord = "目的地经纬度"
Object.keys(data).map((key)=>{
url += key + '=' + data[key] +'&';
})
// 此处生成的 url 末尾多一个 & , .substring 截取一下
url = url.substring(0, url.length - 1)
边栏推荐
- 配置文件的读取-TOML
- [ANT]apache ant 安装说明
- Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules
- Likou Brush Question Record 6.1-----203. Remove linked list elements
- 16.flink 自定义KeySelector
- 线段树知识整理
- MT4/MQL4 Getting Started to Mastering EA Tutorial Lesson 1 - MQL Language Common Functions (1) OrderSend() Function
- Json之JArray的使用方法
- 力扣刷题记录9.1-----24. 两两交换链表中的节点
- gpio子系统和pinctrl子系统(上)
猜你喜欢
随机推荐
JDBC technology (2) - set up common sql and configuration files
危化企业双预防机制数字化建设工作要求
Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules
力扣刷题记录2.1-----27. 移除元素
点击div内部默认文本被选中
力扣刷题记录1.5-----367. 有效的完全平方数
力扣刷题记录10.1-----19. 删除链表的倒数第 N 个结点
9.1-----24. Swap the nodes in the linked list in pairs
MT4 / MQL4 entry to the master of EA course lesson two - commonly used functions
2022中国眼博会,中国北京国际儿童青少年眼睛健康产业展览会
数仓第二篇: 数据模型(维度建模)
如何在推荐系统中玩转知识图谱
力扣刷题记录9.1-----24. 两两交换链表中的节点
使用JS实现数组扁平化的几种方式
显著性检验--学习笔记
How js implements array deduplication (7 kinds)
终于有人把灰度发布架构设计讲明白了
Etcd realize large-scale application service management of actual combat
史上最猛“员工”,疯狂吐槽亿万富翁老板小扎:那么有钱,还总穿着同样的衣服!
2022 PMP Project Management Certification Exam Registration Guide (1)