Reputation: 63
Trying to pass internal links in my template, but it does not direct to the links.
<nuxt-link
to="blog.url"
>{{ blog.title }} by {{ blog.author }}</nuxt-link
>
And in my data I have this (where blog.title and blog.author correctly work)
data() {
return {
blog: [
{ url: '/blog1', title: 'my first title', author: 'Brad' },
{ url: '/blog2', title: 'my second title', author: 'James' },
{ url: '/blog3', title: 'my third title', author: 'Tom' }
]
}
}
The output from the nuxt-link is simply "blog.url" and does not route anywhere. How to make it route to my internal links specified per blog1, blog2, blog3?
Upvotes: 0
Views: 63
Reputation: 2244
You want :to
, not to
. Without the colon, you’re pointing to the string “blog.url”, not your data.
Upvotes: 1