element-ui中使用@mouseenter、@mouseleave等不起作用

狂奔的蝸牛發表於2019-02-16

vue專案中使用element-ui框架,在element標籤中使用@mouseenter不起作用。web專案中的寫法如下:
<el-button type=”primary” @mouseenter=”loginBtn()”>登入</el-button>。
移動滑鼠,目前不能觸發該事件。

修改後的寫法如下(觸發事件加上native):
<el-button type=”primary” @mouseenter.native=”loginBtn()”>登入</el-button>。

分析原因:elementUI內部把相關的方法禁止。
依次推論並驗證:在非element標籤中使用@mouseenter,能正常執行,無需新增native。

相關文章