queryString.ts 338 B

123456789101112131415
  1. import qs from 'query-string'
  2. export const getQuery = () => {
  3. let search: any = {}
  4. try {
  5. search = {
  6. ...qs.parse(location.search),
  7. ...qs.parse(location.hash.split('?')[1]),
  8. }
  9. } catch (error) {
  10. console.log("解析query错误:", error)
  11. }
  12. return {
  13. ...search,
  14. }
  15. }