π¦ Nested routing, page controller lifecycle, and more #7
MihaelIsaev
announced in
Announcements
Replies: 1 comment
-
|
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
FragmentRouter
We may not want to replace the entire content on the page for the next route, but only certain blocks.
This is where the new
FragmentRoutercomes in handy!Let's consider that we have tabs on the
/userpage. Each tab is a subroute, and we want to react to changes in the subroute using theFragmentRouterwithout reloading use page even though url changes.Declare the top-level route in the
AppclassAnd declare
FragmentRouterin theUserPageclassIn the example above
FragmentRouterhandles/user/profileand/user/friendssubroutes and renders it under theNavbar, so page never reload the whole content but only specific fragments. There are also may be declared more than one fragment with the same or different subroutes and they all will just work together like a magic!Btw
FragmentRouteris aDivand you may configure it by callingBreaking changes
ViewControllerhas been renamed intoPageController, Xcode will propose to rename it automatically.PageController
PageControllernow have lifecycle methods:willLoad,didLoad,willUnload,didUnload.Also you can declare same methods without overriding, e.g. when you declare little page without subclassing
New convenience methods
alert(message: String)- direct JS alert methodchangePath(to: String)- switching URL pathMore
IdandClassnow can be initialized simply with string like thisTiny little change but may be very useful.
App.current.window.document.querySelectorAll("your_query")now works!Tip
π¨Please don't forget to update
Webber CLItool to version1.6.1or above!This discussion was created from the release π¦ Nested routing, page controller lifecycle, and more.
Beta Was this translation helpful? Give feedback.
All reactions