当前位置:网站首页>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)
边栏推荐
- 力扣刷题记录6.1-----203. 移除链表元素
- Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules
- Which is the best increased whole life insurance?Is it really safe?
- 程序员的日常生活 | 每日趣闻
- 基于JMF视频聊天
- 2020.10.13 Development log
- Flume (四) --------- Flume 企业开发案例
- Force buckled brush problem record 7.1 -- -- -- -- -- 707. The design list
- 力扣刷题记录10.1-----19. 删除链表的倒数第 N 个结点
- Several ways to use JS to achieve array flattening
猜你喜欢

2.1-----27. Remove elements

MT4/MQ4L入门到精通EA教程第二课-MQL语言常用函数(二)-账户信息常用功能函数

Line segment tree of knowledge

企业面临的五大数据安全挑战

最新工业界推荐系统数据集-召回排序模型原理、结构及代码实战整理分享

Electromagnetic radiation safety standards and detection methods

MySQL/Oracle字符串分割

Force buckled brush problem record 7.1 -- -- -- -- -- 707. The design list

js实现数组去重的方式(7种)

企业从云服务的承诺支出中获得最大收益的四种方法
随机推荐
How to play knowledge graph in recommender system
终于有人把灰度发布架构设计讲明白了
MT4 / MQL4 entry to the master of EA course lesson two - commonly used functions
gpio子系统和pinctrl子系统(上)
Json之JArray的使用方法
年金险的安全性怎么样啊?可靠吗?
D. Tournament Countdown
【剑指offer65】不适用加减乘除做加法
配置文件的读取-TOML
USB 触摸在竖屏时校准
程序员的日常生活 | 每日趣闻
The last exam before the NPDP revision!caution
历史最全DL相关书籍、课程、视频、论文、数据集、会议、框架和工具整理分享
力扣刷题记录8.1-----206. 反转链表
项目经理VS产品经理,二者到底有何不同?
连接数据库且在网页运行的RDLC
为什么应用程序依赖关系映射对于云迁移至关重要
Likou Brush Question Record 8.1-----206. Reverse linked list
MAYA发动机建模
.reduce()的简单例子