vue.js - 多个div上的Vuejs相同功能需要单独运行
问题描述
好吧,我有这两个带有鼠标悬停的 div,它们具有相同的功能。现在的问题是,如果我将鼠标悬停在其中一个上,那么两者都会发光。如何解决这个问题?当我将它们悬停时,它们会一一发光。
DIVS:
<div class="latestItemBody" @mouseover="shineItemIcon"
@mouseout="shineOff" :style="{background: activeCardBg}">
<div class="latestItemBody" @mouseover="shineItemIcon"
@mouseout="shineOff" :style="{background: activeCardBg}">
职能:
methods: {
shineItemIcon() {
this.activeCardBg = '#7a00ff';
this.bounce = 'animated bounceIn';
},
shineOff() {
this.activeCardBg = '';
this.bounce = '';
}
解决方案
将div id 作为参数传递给shineitemicon 和shineoff 函数。根据条件设置“activeCardBg”值。将 activecardBg1 给第一个 div,将 activeCardBg2 给第二个 div。
推荐阅读
- javascript - Redux-persist 集成问题
- google-app-engine-python - App Engine python柔性环境3.6还是3.7?
- chart.js - 在 chart.js 中,通过单击按钮更改图表颜色
- c# - 动态 SQL 的 SQL 端白名单是否存在问题?
- reactjs - 访问本地存储中的图像
- c# - 使用没有证书文件的 TLS 连接到 MariaDB
- python - MongoDB 副本集 - 连接时出现错误“提供节点名或服务名,或未知”
- node.js - 将数据从服务器(Node.js)发送到 GraphQL 服务器中的客户端(React 组件)
- sql - 从同一行获取非空日期的计数
- python - 使用开始和结束日期左连接