简体   繁体   English

react-notifications-component 自定义内容示例

[英]react-notifications-component custom content example

I am using react-notifications-component and I see that I can have a custom component shown by setting.content of the iNotification object passed to Store.addNotification().我正在使用 react-notifications-component,我看到我可以通过传递给 Store.addNotification() 的 iNotification object 的 setting.content 显示一个自定义组件。 I would like to add a control to the existing component that comes with this library (I want to add a button to copy the message to the clipboard).我想为这个库附带的现有组件添加一个控件(我想添加一个按钮来将消息复制到剪贴板)。 If I could extend the existing component, this could be relatively easy, but I don't see how to do this.如果我可以扩展现有组件,这可能相对容易,但我不知道如何做到这一点。 I don't want to "reinvent the wheel" since the 'native' component works and looks great.我不想“重新发明轮子”,因为“本机”组件可以工作并且看起来很棒。

Does anyone have examples of this type of functionality?有没有人有这种功能的例子? Thanks.谢谢。

I dont think there is way to do it, unless you ask the author.. But honestly its fairly easy to implement own component that looks just like the original one, so I dont think it would even make sense to have this functionality, but you can ask.. Anyway I played around and made custom component which copies text ( but from input not from a div therefore the style broke a bit, but if you have a div it again looks just the same..我不认为有办法做到这一点,除非你问作者。但老实说,实现自己的组件看起来就像原来的一样容易,所以我认为拥有这个功能甚至没有意义,但是你可以问..无论如何,我玩弄并制作了复制文本的自定义组件(但不是来自divinput ,因此样式有点破坏,但如果你有一个div ,它看起来还是一样的..

working example 工作示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM