gpt4 book ai didi

javascript - React 移除内联样式

转载 作者:行者123 更新时间:2023-11-30 19:56:53 25 4
gpt4 key购买 nike

我正在使用 React 编写 HTML 电子邮件。与任何优秀的 HTML 电子邮件一样,我使用的是针对 Microsoft Outlook 等旧版客户端的内联样式。一些样式在渲染过程中被 React 移除。如何添加对这些样式的支持或解决此问题?样式必须内联。

这是一个例子:

function MyComponent() {
const style = {
fontFamily: 'Arial, Helvetica, sans-serif',
msoHide: 'all'
}

return(
<div style={style}>
Some text goes here...
</div>
)
}

渲染时,mso-hide: all 样式被移除:

<div style="font-family: Arial, Helvetica, sans-serif;">
Some text goes here...
</div>

最佳答案

文档说样式对象中特定于 vendor 的属性必须以大写字母开头,例如WebkitAppearance 而不是 webkitAppearance。他们还说 ms 是该规则的异常(exception)。 See here .

不过,这还是 msoMsoHide 是否有效?

关于javascript - React 移除内联样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53889568/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com