[Vuejs]-Vue.js โ€“ Change v-bind:style on mouseover

0๐Ÿ‘

You are returning an object from your method which is not applying the style to the element. You could set a boolean in your state which determines the styles applied to the element and handle the rest in your template. Or you could let your boolean determine to merge the style in your computed styles.

0๐Ÿ‘

This is the best solution you are looking for https://stackoverflow.com/a/46553407/14438744 (use background-image instead)

If you really want to use mouseover, then stylesOnHover need to be a method or if computed then it needs to return a function. You will then change the backgroundImage of event.target.style inside that method/function.

Leave a comment