Riot.js 如何更新防暴标签的属性?

Riot.js 如何更新防暴标签的属性?,riot.js,Riot.js,我创建了一个riot标记,它在循环中呈现许多svg元素 <circle ref={ keyName } each={ point,keyName in opts.points } ></circle> 现在我有两个条件 更新特定标记 更新所有标签 要更新特定标记的属性,我使用this.refs[someName].setAttributes(“cx”,30) 要更新所有标记的属性,我应该在循环中使用上述方法吗?或者我应该更新opts.points并调用this.up

我创建了一个riot标记,它在循环中呈现许多svg元素

<circle ref={ keyName } each={ point,keyName in opts.points } ></circle>

现在我有两个条件

  • 更新特定标记
  • 更新所有标签
  • 要更新特定标记的属性,我使用
    this.refs[someName].setAttributes(“cx”,30)


    要更新所有标记的属性,我应该在循环中使用上述方法吗?或者我应该更新
    opts.points
    并调用
    this.update()

    您只需要更新您的列表opts.points和riot.js就可以更改html,而无需您在评论时使用jQuery引用每个项目

    检查opts.list是否正在更新,这可能是您的问题,但您可以通过以下方式解决此问题:

     <circle ref={ keyName } each={ point,keyName in this.points } ></circle>
     <script>
        this.points = opts.points // the parent component is providing a list
    
        someFunction() {
           this.points = ["something", "whatever", "another thing"]
           this.update()
        }
    </script>
    
    
    this.points=opts.points//父组件正在提供一个列表
    someFunction(){
    this.points=[“某物”、“无论如何”、“另一件事”]
    this.update()
    }
    
    你找到解决这个问题的方法了吗?没有,我没有找到直接的方法。所以我使用jQuery来实现这一点。