[SOLVED] Define component methods in routes

I’d like to define component local methods in external js instead of inline code (using pure JS, not Vue) because it is easier to debug and I can bundle js later for minificaiton.

I think currently routes can only pass events and context to component, but not methods?
eg:
{
path: /'
componentUrl: ‘xxx’,
options: {
context :{},
methods: {} //define component local methods here?
on: {} //devent
}
}

OK checking the code I realized that I can just pass methods as context

1 Like

Just to advise anyone looking to do the same here (use componentUrl but leave code in external js and passing methods as route context), @click on component page working fine, but f7 doesn’t forward component instance into the function context. But the component instance is available as app.view.main.router.currentPageEl.f7Component.