jeudi 21 novembre 2019

how can i acces a specific variable from laravel 6.x to vuejs (i try implement mouseover dinamically)

i need access to a especific object from my array, this array comes from my controller.

<div class="col-md-3" v-for="(aesp ,index) in aespNew" :key="aesp.id" :data-id="aesp.id">
                <div v-if="aesp.lang == 0">
                    <button type="button"
                    v-bind:style="{ backgroundColor: aesp.color, color: texColor, borderColor: aesp.color }"
                    class="btn btn-primary"
                    @mouseover="mouseOver()"
                    @mouseout="mouseOut()"
                    :data-id="aesp.area_id"
                    > <span><b></b></span>
                    </button>
                    <br>
                </div>
        </div>

and I need access to aesp.color in my function mouseOver

 mouseOver: function(){

  console.log(this.aespNew);
  this.bgColor = 'yellow'; //<-- the aesp.color hear, but i cant for now, why?

       },

and this console.log(this.aespNew); print

enter image description here

this function when i hover any item of buttons, the items hover too with the same color of button



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire