简体   繁体   English

我们如何使用危险的 SetInnerHTML 和 read-more-react - npm?

[英]How can we use dangerouslySetInnerHTML with read-more-react - npm?

how can we set dangerouslySetInnerHTML in text field, it shows error.我们如何在文本字段中设置危险的SetInnerHTML,它显示错误。

  <ReadMoreReact text={yourTextHere}
            min={minimumLength}
            ideal={idealLength}
            max={maxLength}
            readMoreText={readMoreText}/>

in the "yourtexthere" i want to add dangerouslySetInnerHTML在“yourtexthere”中,我想添加危险的SetInnerHTML

if you are receiving htmlString then you can add read more button Without using read more react package.如果您收到 htmlString 那么您可以添加阅读更多按钮而不使用阅读更多反应包。

Wrap up your content in a div and add maxheight and overflow property to the div.将您的内容包装在一个 div 中,并将 maxheight 和 overflow 属性添加到 div。

now add show more or less button at the end handle the values from the state to update div property maxheight and overflow现在在最后添加显示更多或更少按钮处理来自状态的值以更新 div 属性 maxheight 和溢出

Hope this help you out worked for me.希望这能帮助你为我工作。 Feel free to ask if you don't get it.如果您不明白,请随时询问。

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

相关问题 为 read-more-react 创建 index.d.ts npm package - create index.d.ts for read-more-react npm package 如何使用危险的SetInnerHTML加载内容来处理“多读或少读” - How to handle "read more or less" using dangerouslySetInnerHTML to load Content 在使用dangerouslySetInnerHtml呈现内容时如何使用React链接? - How to use React links when rendering content with dangerouslySetInnerHtml? 反应使用危险的SetInnerHTML 渲染带有 html 标签的 json - react use dangerouslySetInnerHTML to render json with html tags React.js - 有条件地使用dangerouslySetInnerHTML - React.js - conditionally use dangerouslySetInnerHTML 反应:危险地SetInnerHTML - React: dangerouslySetInnerHTML 我们可以在 react native expo 项目中使用 react native (npm) 包吗 - Can we use react native (npm) packages in react native expo project 在后台从 React 组件制作 HTML 字符串,如何在另一个 React 组件中通过危险的SetInnerHTML 使用该字符串 - Making an HTML string from a React component in background, how to use the string by dangerouslySetInnerHTML in another React component 我们如何在 React JavaScript 中使用管道? - How we can use pipes in React JavaScript? React:如何在dangerouslySetInnerHTML的img标签上添加onClick() - React: How to add onClick() on img tag of dangerouslySetInnerHTML
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM