Created
April 13, 2020 02:28
-
-
Save hoyangtsai/23502eb49b31bfbd89262ac2f528b524 to your computer and use it in GitHub Desktop.
Vue-Router custom query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const router = new Router({ | |
routes: [ | |
// ... | |
], | |
// set custom query resolver | |
parseQuery(query) { | |
return qs.parse(query); | |
}, | |
stringifyQuery(query) { | |
var result = qs.stringify(query); | |
return result ? ('?' + result) : ''; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment