Browse Source

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

master
Marek Piasecki 2 years 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 param
prop disabled prop disabled
@ -7,23 +11,23 @@ tag toggle
def render def render
<self.activated=R.params[param] .disabled=disabled @click.if(!disabled)=R.toggle(param)><slot> <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 view
prop target = {} prop params = {}
prop go prop go
def render def render
let link = go || url 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 get url
R.to_path view, target R.to_path view, params
tag ref < ref-f tag pro-ref < pro-ref-f
get url get url
#target = JSON.parse JSON.stringify(target) # duplicate object #params = JSON.parse JSON.stringify(params) # duplicate object
#target[k] ||= v for own k, v of R.safe_params #params[k] ||= v for own k, v of R.safe_params
R.to_path view, #target R.to_path view, #params
tag not_found tag view-not_found
<self><h1> "Page not found :(" <self><h1> "Page not found :("
Loading…
Cancel
Save