js处理去掉富文本编辑的html,样式,只显示纯文字内容,以供列表页使用

<script type="text/javascript">
	var description = '<p style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt;margin-left: 0cm;text-indent:24.1pt;mso-char-indent-count:2.0;mso-pagination:widow-orphan"> <b><span lang="EN-US" style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">1.</span></b><b><span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">国际保险经纪行业收入分析<span lang="EN-US"><o:p></o:p></span></span></b></p> <p style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt;margin-left: 0cm;text-indent:24.0pt;mso-char-indent-count:2.0;mso-pagination:widow-orphan"> <span lang="EN-US" style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">2010</span><span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">年全球保险经纪行业市场规模为<span lang="EN-US">437.56</span>亿美元,<span lang="EN-US">2015</span>年增长至<span lang="EN-US">581.3</span>亿美元。<span lang="EN-US"><o:p></o:p></span></span></p> <p align="center" style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt; margin-left:0cm;text-align:center;mso-pagination:widow-orphan"> <span lang="EN-US" style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">2010-2015</span><span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">年国际保险经纪行业市场规模:亿美元</span></p> <p style="margin: 19.5pt 0cm; text-indent: 24.1pt; text-align: center;"> <img alt="" src="/baoxian/userfiles/1/images/back/news/2018/01/11.png" style="width: 493px; height: 296px;" /></p> <p style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt;margin-left: 0cm;text-indent:24.1pt;mso-char-indent-count:2.0;mso-pagination:widow-orphan"> <b><span lang="EN-US" style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">2.</span></b><b><span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">国际保险经纪行业并购分析<span lang="EN-US"><o:p></o:p></span></span></b></p> <p style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt;margin-left: 0cm;text-indent:24.0pt;mso-char-indent-count:2.0;mso-pagination:widow-orphan"> <span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">保险经纪公司并购较为频繁,<span lang="EN-US">2011</span>年并购数量为<span lang="EN-US">351</span>件,且呈现增长趋势。一股保险行业的并购风潮正席卷全球各个市场。如意大利投资集团<span lang="EN-US">Exor</span>收购再保险公司<span lang="EN-US">PartnerRe</span>、韬睿惠悦与韦莱集团、韦莱与法国保险经纪公司<span lang="EN-US">GrasSavoye</span>、瑞士保险集团<span lang="EN-US">ACE</span>并购<span lang="EN-US">Chubb</span>以及美国保险公司<span lang="EN-US">Anthem</span>收购<span lang="EN-US">Cigna</span>。而这些不过是近年来保险业并购案清单的一小部分。<span lang="EN-US"><o:p></o:p></span></span></p> <p style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt;margin-left: 0cm;text-indent:24.0pt;mso-char-indent-count:2.0;mso-pagination:widow-orphan"> <span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">然而,在热闹喧嚣的并购消息背后却是严酷的现实。波士顿咨询(<span lang="EN-US">BCG</span>)对<span lang="EN-US">1990</span>~<span lang="EN-US">2014</span>年间<span lang="EN-US">778</span>件涉及保险业的并购案进行了分析,对并购后一年内的股东总回报进行了追踪,最终发现只有<span lang="EN-US">51%</span>的并购能实际创造价值,而<span lang="EN-US">49%</span>的并购案则摧毁了公司的价值。近半数并购案失败可归咎为三大原因:并购准备和执行、并购后整合以及并购时机。<span lang="EN-US"><o:p></o:p></span></span></p> <p style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt;margin-left: 0cm;text-indent:24.1pt;mso-char-indent-count:2.0;mso-pagination:widow-orphan"> <b><span lang="EN-US" style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">3.</span></b><b><span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">保险业持续大整合<span lang="EN-US"><o:p></o:p></span></span></b></p> <p style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt;margin-left: 0cm;text-indent:24.0pt;mso-char-indent-count:2.0;mso-pagination:widow-orphan"> <span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">未来<span lang="EN-US">5</span>年,多个宏观层面的因素将继续推动保险业进行整合。首先是监管继续收紧,尤其是对资本充足率的要求将继续提升,无论是独立保险商还是综合集团都将感到更大的资金压力。利率和投资回报将继续保持较低水平(至少在成熟市场),使传统的寿险业务盈利能力受到限制。<span lang="EN-US"><o:p></o:p></span></span></p> <p style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt;margin-left: 0cm;text-indent:24.0pt;mso-char-indent-count:2.0;mso-pagination:widow-orphan"> <span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">此外,新兴竞争对手的威胁也不可小觑,甚至大型连锁超市和电信公司都有可能颠覆保险行业的价值链。这些企业不但拥有价值连城的消费者数据,而且拥有与客户之间的“最后一公里”连接。在新的运营模式下,传统保险企业难以掌控整条价值链,且容易成为新型商业模式的颠覆目标,例如一些网络聚合搜索产品能够为消费者提供价格透明的产品对比。<span lang="EN-US"><o:p></o:p></span></span></p> <p style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt;margin-left: 0cm;text-indent:24.0pt;mso-char-indent-count:2.0;mso-pagination:widow-orphan"> <span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">资金充裕的大型保险公司可以利用投资抵御创新带来的威胁,而那些只聚焦于内部运营,对外部变化视而不见的中型企业将面临更激烈的竞争。对于保险公司来说,了解消费者的行为和需求是至关重要的能力,然而建设必需的大数据技术、文化和团队带来的成本巨大,让规模较小的保险公司难以承受。对于保险企业来说,有机成长的机会非常有限。成熟市场已经进入到整合周期内,尽管新兴市场存在着发展机遇,但市场环境非常复杂。要在新市场形成规模效应,并购显然仍是各大保险企业的明智之选。<span lang="EN-US"><o:p></o:p></span></span></p> <p align="center" style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt; margin-left:0cm;text-align:center;mso-pagination:widow-orphan"> <span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">世界排名前十保险经纪公司国际业务占比<span lang="EN-US"><o:p></o:p></span></span></p> <p align="center" style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt; margin-left:0cm;text-align:center;mso-pagination:widow-orphan"> <img alt="" src="/baoxian/userfiles/1/images/back/news/2018/01/12.png" style="width: 554px; height: 289px;" /></p> <p style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt;margin-left: 0cm;text-indent:24.1pt;mso-char-indent-count:2.0;mso-pagination:widow-orphan"> <b><span lang="EN-US" style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">4.</span></b><b><span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">国际保险经纪行业利润水平<span lang="EN-US"><o:p></o:p></span></span></b></p> <p style="margin-top:19.5pt;margin-right:0cm;margin-bottom:19.5pt;margin-left: 0cm;text-indent:24.0pt;mso-char-indent-count:2.0;mso-pagination:widow-orphan"> <span style="font-family:宋体;mso-bidi-font-family:宋体;color:#252525">目前,<span lang="EN-US">2015</span>年全球保险经纪行业收入达<span lang="EN-US">581.3</span>亿美元,国际保险经纪行业利润水平维持在<span lang="EN-US">10~25%</span>之间。<span lang="EN-US"><o:p></o:p></span></span></p>';
		description = description.replace(/(\n)/g, "");  
		description = description.replace(/(\t)/g, "");  
		description = description.replace(/(\r)/g, "");  
		description = description.replace(/<\/?[^>]*>/g, "");  
		description = description.replace(/\s*/g, "");
		console.log(description)
		

</script>

  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
### 回答1: 你可以使用一个名为DOMPurify的库来清除富文本编辑器中的HTML标签,它可以有效地过滤不安全的HTML标签和属性。下面是一个使用该库实现去除HTML标签的示例代码: ```javascript import DOMPurify from 'dompurify'; const dirtyHtml = '<p><span>Some</span> <b>HTML</b> <i>text</i></p>'; const cleanText = DOMPurify.sanitize(dirtyHtml, { ALLOWED_TAGS: [] }); console.log(cleanText); // Output: Some HTML text ``` 在上面的代码中,我们首先导入DOMPurify库。然后,我们创建一个包含HTML标签的字符串。接下来,我们使用DOMPurify的sanitize()方法,将其传入要保留的标签列表。在这个例子中,我们传入一个空的标签列表,这将导致所有HTML标签都被过滤掉。最后,我们输出经过过滤的纯文本。 ### 回答2: Vue富文本编辑器中要去掉标签,可以利用正则表达式或者DOM操作来实现。 方法一:利用正则表达式 可以使用正则表达式将标签去掉,示例代码如下: ```javascript function removeTags(input) { return input.replace(/<[^>]+>/g, ''); } // 使用示例 let content = '<p>这是一段带有标签的文本</p>'; let text = removeTags(content); console.log(text); // 输出:这是一段带有标签的文本 ``` 方法二:利用DOM操作 可以创建一个DOM节点,将内容作为innerHTML设置进去,然后获取节点的textContent,示例代码如下: ```javascript function removeTags(input) { let div = document.createElement('div'); div.innerHTML = input; return div.textContent || div.innerText || ''; } // 使用示例 let content = '<p>这是一段带有标签的文本</p>'; let text = removeTags(content); console.log(text); // 输出:这是一段带有标签的文本 ``` 以上两种方法都可以实现将富文本编辑器的内容中的标签去掉,得到纯文本内容。根据实际需求选择其中一种方法即可。 ### 回答3: Vue富文本编辑器的文字去掉标签,可以通过使用正则表达式或者DOM操作来实现。 一种简单的方法是使用正则表达式,通过替换标签标记来去除标签。例如,可以使用以下代码: ```javascript // 假设文本内容保存在一个名为content的变量中 content = content.replace(/<[^>]+>/g, ''); // 这将删除所有的HTML标签,只保留纯文本内容 ``` 另一种方法是使用DOM操作,将文本内容插入到一个临时的div元素中,然后获取纯文本内容。以下是一个示例代码: ```javascript // 假设文本内容保存在一个名为content的变量中 // 创建一个新的div元素 const tempDiv = document.createElement('div'); // 将文本内容插入到div中 tempDiv.innerHTML = content; // 获取纯文本内容 const plainText = tempDiv.textContent || tempDiv.innerText; // 使用plainText变量来获取只包含纯文本内容,而不包含标签 ``` 这两种方法都可以实现去除Vue富文本编辑器中的HTML标签,让文本只包含纯文本内容

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值