SVG 元素的“enable-background”的正确结构是什么?

Sho*_*orn 5 css svg typescript definitelytyped reactjs

我使用 React w/ Typescript,使用“DefinitelyTyped”定义。我最近使用 v16.3.9 React 类型 ( @types/react) 从 React v16.0.0 升级到 v16.3.0。

我曾经让我的 SVG 元素看起来像这样,并enable-background作为样式属性:

import * as React from "react"

export class CaretSvgRight
extends React.PureComponent<React.SVGProps<SVGElement>, object> {

  render(){
    return <svg 
      style={{"enable-background":"new 0 0 292.359 292.359"}}
      {...this.props}            
    >
      <path d="..."/>
    </svg>
  }
}
Run Code Online (Sandbox Code Playgroud)

使用新的类型,我必须将SVGSVGElementSVGProps 类型的目标更改为看起来很奇怪的类型,这需要我将enable-background属性移动到关卡上SVG

import * as React from "react"

export class CaretSvgRight
extends React.PureComponent<React.SVGProps<SVGSVGElement>, object> {

  render(){
    return <svg 
      enableBackground="new 0 0 292.359 292.359"
      {...this.props}            
    >
      <path d="..."/>
    </svg>
  }
}
Run Code Online (Sandbox Code Playgroud)

这看起来正确吗,还是我应该做一些不同的事情来将enable-background属性重新放入样式属性中(之前的输入是否错误,该属性应该位于元素上SVG,还是现在错误?)

无论如何,SVG 在浏览器中的外观似乎没有任何区别(在 Chrome 中测试) - 我应该删除整个enable-background内容而不用担心它吗?