vue.js:在HTML中突出显示javascript数组中的新对象

vue.js:在HTML中突出显示javascript数组中的新对象,javascript,vue.js,vuejs2,Javascript,Vue.js,Vuejs2,我正在使用一个表来呈现项目集合。 每当我向集合中添加新项时,我都希望在表中为用户高亮显示新项1秒。 如何从.vue文件访问新对象并在1秒内更改其背景色 这是我添加新对象的代码: var indicator = this.tableIndicators.find(x => x.id === indicatorId) var indicatorIndex = this.tableIndicators.findIndex(x => x.id == indicatorId); this.ta

我正在使用一个表来呈现项目集合。 每当我向集合中添加新项时,我都希望在表中为用户高亮显示新项1秒。 如何从.vue文件访问新对象并在1秒内更改其背景色

这是我添加新对象的代码:

var indicator = this.tableIndicators.find(x => x.id === indicatorId)
var indicatorIndex = this.tableIndicators.findIndex(x => x.id == indicatorId);
this.tableIndicators.splice(indicatorIndex, 1); //remove indicator from indicators collection
this.tableData.unshift(indicator); // add indicator to table-data

通过@Stepehn的链接,这解决了我的问题“列表进入/离开转换”:

您好,实际上最好的方法是CSS动画,它将允许您新添加的项目在一定时间内具有特定的样式@Stepehn,你太棒了!