Uniapp中如何展示html的富文本?-灵析社区

777七月

后台返回整个静态页面的html的富文本 p{margin-top:0pt;margin-bottom:1pt;}p.a{text-align:justified;}span.a{font-size:10.0pt;}p.X1{margin-top:18.0pt;margin-bottom:18.0pt;}span.X1{font-family:'黑体';font-size:12.0pt;}span.X2{font-family:'黑体';font-size:12.0pt;}p.X3{text-align:left;text-indent:21.0pt;margin-top:6.0pt;}span.X4{font-family:'黑体';font-size:12.0pt;}span.X5{font-family:'黑体';font-size:12.0pt;}span.X6{font-family:'黑体';font-size:12.0pt;}p.X7{margin-top:12.0pt;margin-bottom:3.0pt;}span.X7{font-size:10.0pt;font-weight:bold;}p.X8{margin-top:12.0pt;margin-bottom:3.0pt;}span.X8{font-family:'Arial';font-size:10.0pt;}p.X9{text-align:center;}span.X9{font-family:'Arial';font-size:16.0pt;}p.a3{text-indent:24.0pt;}span.a3{font-size:12.0pt;}span.Char{font-size:12.0pt;}p.X10{text-align:left;text-indent:53.0pt;}span.X10{font-size:12.0pt;}span.X1Char0{font-size:12.0pt;}p.X20{text-align:left;text-indent:79.0pt;}span.X20{font-size:12.0pt;}span.X2Char0{font-size:12.0pt;}span.X1Char{font-family:'黑体';font-size:12.0pt;}span.X2Char{font-family:'黑体';font-size:12.0pt;}span.X3Char{font-family:'黑体';font-size:12.0pt;}p.a4{text-indent:21.0pt;margin-top:2.0pt;margin-bottom:2.0pt;}span.a4{font-size:12.0pt;}span.X4Char{font-family:'黑体';font-size:12.0pt;}span.X5Char{font-family:'黑体';font-size:12.0pt;}span.X6Char{font-family:'黑体';font-size:12.0pt;}span.X7Char{font-weight:bold;}span.X8Char{font-family:'Arial';}span.X9Char{font-family:'Arial';font-size:16.0pt;}span.a5{font-family:'Arial';font-size:10.0pt;}span.Char0{font-family:'Arial';}p.a6{text-align:center;margin-top:12.0pt;margin-bottom:3.0pt;}span.a6{font-family:'Cambria';font-size:16.0pt;font-weight:bold;}span.Char1{font-family:'Cambria';font-size:16.0pt;font-weight:bold;}span.a7{font-weight:bold;}p.X50{text-align:left;text-indent:84.0pt;}p.a8{text-align:center;}span.a8{font-size:9.0pt;}span.Char2{font-size:9.0pt;}p.a9{text-align:left;}span.a9{font-size:9.0pt;}span.Char3{font-size:9.0pt;}p.X21{text-indent:5.0pt;margin-bottom:0.0pt;}span.X21{font-size:14.0pt;}p.ab{margin-bottom:6.0pt;}span.Char4{font-size:10.0pt;}p.aa{text-indent:21.0pt;}span.Char5{font-size:10.0pt;}span.ac{font-size:9.0pt;}span.Char6{font-size:9.0pt;}厦门电波观测站一.基本情况厦门站的电波环境实时观测以电离层环境观测为主,配置有关观测设备,中国电子科技集团公司和部队单位联合开展电波环境观测、数据资源共享。二.主要职责该站的主要职责是开展电离层垂测、电离层斜测和卫星信号闪烁观测。收集、处理、存储该站的观测数据资料并快速、完整、准确、安全地将数据资料传输! uniapp怎么能生成这个html 或者 在本地给一个html然后 把生产的富文本传递进去 让他展示出来 需要展示的html应该怎么接收这些富文本数据展示出来?

阅读量:17

点赞量:0

问AI
uniapp我没记错的是时vue吧,试试"V-HTML" (https://link.segmentfault.com/?enc=pCm3iTAhOVxZs8HjxLrhtQ%3D%3D.64p11BHw%2BsQuQpQbISPm9b51uOxQzdCaiM%2B5ycRYHEgviBtoLtqccW3G3d00GdK4RZjfkOeCQTCXY90yX2GhhA%3D%3D) 我试了是没问题的 "看dmeo" (https://codepen.io/wzc570738205/pen/ZEPbxYX) "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241016/2ca8f3a4389e38e56e82524ab18f9092.png) *** 看了下uniapp的"v-html文档" (https://link.segmentfault.com/?enc=je9zLBwaeyz3M0X9GiiioQ%3D%3D.Hu9WDl%2BINDRnbnzggf6ln8OUT11Qo1DzNBG48xacX4HD1ANkettcY%2Fx9UHcyS%2BtTNfQPTvauCdgpmLnJ1t90NQ%3D%3D),以及"官方的解决方案" (https://link.segmentfault.com/?enc=Eh0fJo1UKgZjidemvEvUqQ%3D%3D.G7zkhry8oZXb3vj9WLFh%2BbC8aVqlkwjBcgIMxgQa%2B9jtA7sn0eb7edwVp%2Fl0ebvg) "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241016/59119877b93220e7a37baea76b951381.png) *** 补充:去除html body const html = "hello world"; // 使用正则表达式替换 const result = html.replace(/\s*|\s*/g, ''); console.log(result); // hello world 补充:给img加class var html = ''; // 使用正则表达式替换所有的标签 var modifiedHtml = html.replace(/