Home > Blockchain >  How to use v-if to to return true if route ends in number
How to use v-if to to return true if route ends in number

Time:04-24

How do I replace * so that this v-if only matches a route ending in a number.

<div v-if="route().current('reporter.*')">

It should be true for /reporter/18 and be false for /reporter/home

CodePudding user response:

You could use regex match:

<div v-if="$router.currentRoute.path.match(/reporter\/\d /)">

(depending on how you get the current route as a string)

CodePudding user response:

There’s a javascript function isNaN

  • Related