Browse Source

fix: imba2 and web components works correctly only with names longer than 1 word

master
Marek Piasecki 1 year ago
parent
commit
fd0e1fb877
  1. 24
      src/router_tag.imba

24
src/router_tag.imba

@ -1,4 +1,8 @@
tag toggle
tag pro-router
prop view
<self><{ "view-{view || R.view }" }>
tag pro-toggle
prop param
prop disabled
@ -7,23 +11,23 @@ tag toggle
def render
<self.activated=R.params[param] .disabled=disabled @click.if(!disabled)=R.toggle(param)><slot>
tag ref-f # f - forget current params in new destination
tag pro-ref-f < a # f - forget current params in new destination
prop view
prop target = {}
prop params = {}
prop go
def render
let link = go || url
<self[d:inline]><a.active=(R.to_path! == link) href=link @click.prevent=R.go(link)><slot>
<self[d:inline].active=(R.to_path! == link) href=link @click.prevent=R.go(link)><slot>
get url
R.to_path view, target
R.to_path view, params
tag ref < ref-f
tag pro-ref < pro-ref-f
get url
#target = JSON.parse JSON.stringify(target) # duplicate object
#target[k] ||= v for own k, v of R.safe_params
R.to_path view, #target
#params = JSON.parse JSON.stringify(params) # duplicate object
#params[k] ||= v for own k, v of R.safe_params
R.to_path view, #params
tag not_found
tag view-not_found
<self><h1> "Page not found :("
Loading…
Cancel
Save