vuetifyjs / vuetify

🐉 Vue Component Framework
https://vuetifyjs.com
MIT License
39.06k stars 6.91k forks source link

fix(router): empty string to represent real empty "to" #19614

Closed yuwu9145 closed 2 weeks ago

yuwu9145 commented 2 weeks ago

fixes #19549

Description

Markup:

<template>
  <v-app>
    <v-container>
      <v-list nav>
        <v-list-item to="/">
          home
        </v-list-item>
        <v-list-item to="/foo">
          foo
        </v-list-item>
        <v-list-item :to="to">
          bar
        </v-list-item>
      </v-list>
      <v-btn @click="showTo = !showTo">toggle To</v-btn>
      <hr class="my-4" />
      <h1>
        <router-view></router-view>
      </h1>
    </v-container>
  </v-app>
</template>

<script>
  export default {
    data () {
      return {
        showTo: false
      }
    },
    computed: {
      to() {
        if (this.showTo) return '/bar'

        return ''
      }
    }
  }
</script>