2025年02月24日 建站教程
需求介绍:如何利用encodeURIComponent
对数组进行编码,下面web建站小编给大家简单介绍一下!
解决方法:
1、利用JSON.stringify转换
var arr = [{name:'小米', age:21},{name:'web', age:19},{name:'小明', age:32}] var obj = JSON.stringify(arr)
2、encodeURIComponent编码
console.log('编码:', encodeURIComponent(obj))
本文链接:http://so.lmcjl.com/news/23769/