无法以角度为 foreignObject 设置位置(x,y)
我试过这样:
<foreignObject width="65" height="50" x="{{position?.x}}" y="{{position?.y}}">
<div class="container">works!</div>
</foreignObject>
和
<foreignObject width="65" height="50" [x]="position?.x" [y]="position?.y">
<div class="container">works!</div>
</foreignObject>
但是绑定会出错:
无法设置只有 getter 的 [object SVGForeignObjectElement] 的属性 x
如果我这样设置位置,它会起作用:
<foreignObject width="65" height="50" x="100" y="100">
<div class="container">works!</div>
</foreignObject>
如何将动态位置设置为foreignObject?