简体   繁体   中英

How to change html content(Font-Awesome Icon) for individual list objects on mouse hover using Vue.js

My goal is to change a font-awesome icon for list items displayed with Vue on mouse hover. Basically, I want to recreate this functionality with Vue.js.

I know there are plenty of ways to do this with css and js, and have even included how to do it using pure css in the link above, but I'm curious if I can do this using vue alone.

Here's the code generating the list of data displayed:

<div id="file-content" class="hover file-row-container fr-open-dir"
     v-on:click="SetSelected(dirObj.id)"
     v-for="dirObj in displayedFolders">
    <div class="file-row">
        <div class="file-row-icon">
            <i class="fa fa-folder-o" aria-hidden="true"></i>
        </div>
        <span class="file-row-text hover-ul">
            {{dirObj.name}}
        </span>
    </div>
</div>

css is the best option here. Yes you can but I do not recommend . Because it's not optimal for your operation. You can use @mouseover and @mouseleave event for handle this

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