johnny
johnny

Reputation: 3

How can this code be implemented in vue 2.0?

<a href="http://en.wikipedia.org/?title={{obj.title}}" target="_blank"></a>

This code can work in vue 1.0,but in vue 2.0 it's return error

<a v-bind:href="http://en.wikipedia.org/?title=obj.title" target="_blank"></a>

This also cannot work,how can I modify the code?

Upvotes: 0

Views: 35

Answers (1)

Jacob Goh
Jacob Goh

Reputation: 20845

v-bind:href=" 'http://en.wikipedia.org/?title=' + obj.title "

Basically, what is provided in v-bind must return a valid Javascript value. In this case, it's String. Or it could also be Integer, Boolean, Function, Array, Object, ...

Upvotes: 2

Related Questions