api.onPageChangeイベントで現在のルート名を取得する

こんにちは、皆さん、

api.onPageChange イベントで現在のルート名を取得したいです。

    api.onPageChange((url, title) => {
     
    console.log("現在のルート名")
  
  
    });

この上記の関数で、現在のルート名が欲しいのですが、取得できますか?

api.onPageChange((url, title) =>{
  const router = api.container.lookup('service:router');
  console.log(router.currentRoute.name);
}
「いいね!」 2

リチャード、本当にありがとう。おかげで助かりました :star_struck:

「いいね!」 1

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.