Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

vue-router刷新页面,query传参时参数的类型变了

问题描述

vue-router通过query传参,比如:?fromWork=true&extraType=1,传过去的fromWorkboolean型,extraTypenumber型,但是当刷新页面时,拿到的参数都变成了字符串,有没有很好的解决方式

解决方式

1、目前使用的就是拿到参数后进行类型转换了,但总感觉不是最好的方式


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

用boolean型用0/1代替,如果需要number型,则在页面转换即可


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...