URL query string params (Blits)

Hi everyone,

I’m using Blits and I need to redirect to another page and send query string parameters in the url, but I don’t know how to do it. Also, when the new page loads, I need to capture the query string parameters to use on that new page.

I looked at the Blits demo but didn’t find any similar examples.

Thanks for your support

hey @carlosg , is there a specific reason you need to use query string params?

In v 0.6.2. of Blits we’ve added dynamic route params functionality, that may be what you’re after?

We have some work to do on the documentation side, and I also think there isn’t an example that uses this feature yet in the example app, so I can give you the quick gist here:

First you need to register a route with dynamic params. Something like: /tv/:series/episodes/:episode.

When navigating to a hash such as #/tv/simpsons/episodes/episode1 it will match this route, and pass the props series and episode with the appropriate values (simpsons and episode1) into the component of this route.

You just have to make sure that you’ve registered the props on the component you are loading, and then you’ll be able to reference them in your template as $series and $episode, or in the JS of your component as this.series and this.episode.

Blits.Component('EpisodePage', {
  template: ...,
  props: ['series', 'episode'],
  // ...
})

Hope that helps!

Thanks for your comments @michiel, your example is awesome. The dynamic params work correctly, I was able to solve my problem.

Thanks for your time.