Subscribe on changes!

Ternary not work in v-bind:to

avatar
Feb 15th 2022

Version

3.2.31

Reproduction link

github.com

Steps to reproduce

I make when region.code is empty, not showing ?reg=

 <router-link
                :to="
                  $route.href.replace(/\?reg=.{2}/, '') + region.code !== ''
                    ? `?reg=${region.code}`
                    : ''
                "
                >

What is expected?

all showing ?reg= exept empty value

What is actually happening?

All link, include empty region.code showing ?reg=


and when try using this code

<router-link
                :to="
                  region.code !== ''
                    ? $route.href.replace(/\?reg=.{2}/, `?reg=${region.code}`)
                    : $route.href.replace(/\?reg=.{2}/, '')
                "
                >

all link not showing ?reg=

avatar
Feb 15th 2022

This reproduction is not minimal as it involves as lot of unnecessary code. Please boil it down to the minimum required to demonstrate your issue