How to change image on mouseover in vue.js? -


in vue.js, can bind image img element:

<img v-bind:src="myimage" /> 

how can define image displayed when mouse moves on image?

change value of myimage in mouseover listener:

new vue({    el: '#app',    data() {      return {         myimage: "https://s-media-cache-ak0.pinimg.com/originals/bd/5d/84/bd5d845c980508d41b0329dc21d08d2b.jpg",        otherimage: "https://cdn.pixabay.com/photo/2014/03/29/09/17/cat-300572_960_720.jpg"      }    }  });
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.2/vue.min.js"></script>    <div id="app">    <img :src="myimage" @mouseover="myimage = otherimage"/>  </div>


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -