项目中QS.stringify()中数组传递的不同方式


项目中QS.stringify()中数组传递的不同方式

在研究其他人的项目中遇到了数组传递的另外几种方式,因为之前我接触到的传参方式基本都是接受啥传啥,类似于:

	name:小红,
	age:18,
	hobby:[eat,game,shopping]

但是这个项目传递的参数却是这样的:

	name:小红,
	age:18,
	hobby:eat,
	hobby:game,
	hobby:shopping,

查看相关设置和文章得知QS.stringfty()有相关设置:
image

在QS插件中总共有这些参数可设置:

arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma' | undefined;

这里扩展一下其他参数的作用:
indices:

hobby[0]:eat,
hobby[1]:game,
hobby[2]:shopping,

brackets:

hobby[]:eat,
hobby[]:game,
hobby[]:shopping,

repeat:

hobby:eat,
hobby:game,
hobby:shopping,

comma:

hobby:eat,game,shopping,


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM