在Vue.js中的路由器链接的“:to”属性中传递道具

我在vue中创建路由器链接并将其传递为道具的路由名称时遇到问题... 我基本上想做的是这样的:

<template>
  <div>
    <router-link :to="myProps">Login</router-link>
  </div>
</template>

<script>
  export default {
    name: componentName,
    props: {
      myProps: {
        type: String,
        default: '{ name: login }'
      }     
    }
  }
</script>

Login is of course difined in my router. But as I give the route as a props, I get redirected to /%7B%20name:%20'login'%20%7D. Do you know of any trick to get around this ?

评论