Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Apr 16, 2024
Merged

Conversation

yuwu9145
Copy link
Member

@yuwu9145 yuwu9145 commented Apr 15, 2024

fixes #19549

  • Empty string is the one to represent real empty "to" that makes RouterLink.useLink happy demo
  • to={} in RouterLink.useLink is looking for url "/" demo

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>

@yuwu9145 yuwu9145 marked this pull request as ready for review April 16, 2024 12:45
@yuwu9145 yuwu9145 changed the title fix(router): skip RouterLink when props.to is empty fix(router): empty string to represent real empty "to" Apr 16, 2024
@johnleider johnleider added this to the v3.5.x milestone Apr 16, 2024
@johnleider johnleider added T: bug Functionality that does not work as intended/expected E: router labels Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E: router T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report][3.5.14] Weird/broken interaction between v-btn, vue-router and npm run dev
2 participants