search

Home  >  Q&A  >  body text

javascript - Router-link problem in vue-router

Main.vue:

<router-link :to="{name:'Home'}">首页</router-link>

routing:

The error is reported as follows:

Why does using :to="{name:'Home'}" report an error, but the ordinary to="/home" has no problem?

阿神阿神2833 days ago881

reply all(1)I'll reply

  • phpcn_u1582

    phpcn_u15822017-06-12 09:34:23

    This is embarrassing. Vue should directly parse the data in to as a string, so if the method you wrote cannot parse it, an error will be reported.

    reply
    0
  • Cancelreply