简体   繁体   中英

Vuejs v-bind:href returns warning

I've been struggling to correctly bind an object to an anchor on vue.js (note that this is my first time doing vue.js)

<li v-for="object in filterArray" :key="branchurl">
<a v-bind:href="object.url"  v-on:click="function(object)"></a>
</li>

this gets me a "Property or method "data" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property."

My vue code is like this

 var vm = new Vue({
el:  "#app",
data: {

    array: [
        { url:"#1", phone:"", city: "", zipcode: "", name: "", address: "", time1: "", time2: "" },

    ],

},
computed: {
    filterArray: function() {

        return this.arrray;

    }
}
});

I would like some help on which is the correct way of doing this because haven't found something that removes the warning.

Thanks

After some tries and going back to the beggining it seems that vue likes ` between " for v-bind:href to work

ie

<a v-bind:href="`?branch=`+array.url" 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM