微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我可以在Wordpress Gutenberg中使用原始HTML节点吗

如何解决我可以在Wordpress Gutenberg中使用原始HTML节点吗

wordpress Gutenberg使用React,但是不幸的是,我对React并不熟悉。我确实非常了解香草JS,我想只在绝对需要的地方使用React语法来处理原始JS。

因此与wordpress UI进行交互的标准方法是返回如下内容

return (
    <input class={ className } value={attributes.author} onChange={ updateAuthor } type="text" />
);

但是我更希望返回以下内容

let customInput = document.createElement("input");
customInput.type = "text";
customInput.className = "className";
customInput.value = attributes.author;
customInput.onChange = updateAuthor();

return customInput ;

但是,当渲染到wordpress中时,这会导致错误。无论如何,有没有完成这个目标?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。