[英]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.使用 Vue 时,我遇到了与平常不同的事情,无法克服。 The HTML code and JSFiddle links: HTML 代码和 JSFiddle 链接:
<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/案例1(纯JS+HTML+CSS): https://jsfiddle.net/mcezgsa7/32/
Case 2 (Vue.js + HTML + CSS): https://jsfiddle.net/pa2xmyju/12/案例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.我希望我的代码像案例 1 一样工作,但我使用的是 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. 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/ https://jsfiddle.net/v0komLf9/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.