简体   繁体   中英

How can I wrap to child by parent? (not component) Vue.js

When using Vue I am faced with something different than usual and cannot be overcome. The HTML code and JSFiddle links:

    <div class="box align" id="app" onmouseover="fuchsia(id)" onmouseout='notFuchsia(id)'>
      <div class="line align">
        <div class="y-line align">
            <p>get ur pointer yellow line</p>
        </div>
      </div>
    </div> 
<!--JS and CSS in JSFiddle links. Please look at --> 

Case 1 (Pure JS + HTML + CSS): https://jsfiddle.net/mcezgsa7/32/

Case 2 (Vue.js + HTML + CSS): https://jsfiddle.net/pa2xmyju/12/

I want my code to work like the case 1, but I'm using Vue.js. So, I think I can explain the problem.

Well, I did a little bit of rewriting of your code. Notice that I removed your methods, added property hover to data object and added a css class active , which is added to the element when mouse is hovered over it.

https://jsfiddle.net/v0komLf9/

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