代码之家  ›  专栏  ›  技术社区  ›  badigard

js:在html中突出显示javascript数组中的一个新对象

  •  0
  • badigard  · 技术社区  · 6 年前

    我正在使用一个表来呈现一个项目集合。 每当我向集合中添加新项时,我都希望在表中为用户突出显示新项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
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   badigard    6 年前

    按照@stepehn的链接,这解决了我的问题“列表进入/离开转换”: https://vuejs.org/v2/guide/transitions.html#List-Entering-Leaving-Transitions