[Vuejs]-Inline Vue JS object inside tag

0๐Ÿ‘

โœ…

You can use this code:

<a :href="`javascript:parent.call('${ value.text }','1','','2','3');`">

0๐Ÿ‘

Vue 2.0 does not allow interpolation inside attributes, you have to use the binding syntax:

<a v-bind:href="`javascript:parent.call(${ value.text },'1','','2','3');`">

or in short:

<a :href="`javascript:parent.call(${ value.text },'1','','2','3');`">

As a side note, it is preferable to keep the html clean and move this to a computed:

<a :href="link">

computed: {
    link() {
       return `javascript:parent.call(${ this.value.text },'1','','2','3');`
    }
}

Leave a comment