收藏
回答

小程序解析富文本

小程序要解析富文本数据,后端返回的是<p><span style="color: rgb(255, 192, 0);"><strong>活动奖励</strong></span></p>这样的,前端是否能通过rich-text接管样式,还是需要引入wxParse

回答关注问题邀请回答
收藏

3 个回答

  • 2018-11-08

    wx-pares

    2018-11-08
    有用
    回复
  • 谢东寅yin
    谢东寅yin
    2018-11-08

     恩 但我还需要接管样式 比如字体的颜色啊  行高啊 外边距啊 大小啊  这些呢

    2018-11-08
    有用
    回复 6
    • 卢霄霄
      卢霄霄
      2018-11-08

      绝大部分标签和样式是有效的。。

      2018-11-08
      回复
    • 谢东寅yin
      谢东寅yin
      2018-11-08回复卢霄霄

       哈哈哈 你明白我的意思么 。比如后台返回的<p><span style="color: rgb(255, 192, 0);"><strong>活动奖励</strong></span></p>我还需要给P标签加一个Margin-top  单单rich-text做得到么

      2018-11-08
      回复
    • 谢东寅yin
      谢东寅yin
      2018-11-08回复谢东寅yin

       这还不止p标签 基本上其他标签都有对应的样式要求

      2018-11-08
      回复
    • 卢霄霄
      卢霄霄
      2018-11-08回复谢东寅yin

      <p style="font-family: -webkit-standard; box-sizing: inherit; margin-bottom: 18px; display: inline-block; letter-spacing: 1px; caret-color: rgb(55, 55, 55); color: rgb(55, 55, 55); text-indent: 35px; line-height: 2em;"><span style="font-size: 14px;">侠客岛里是国内名列前茅的基于办公资产共享服务的企业加速服务平台。</span></p><p style="caret-color: rgb(0, 0, 0); font-family: -webkit-standard;"><span style=";color: #373737;;caret-color: #373737; font-size: 14px; letter-spacing: 1px;"><img src="https://static.hi-best.net/upload/business/ueditor/20181101/1541050727115836.png" alt="图片.png" style="width: 0px;"/></span></p><p style="caret-color: rgb(0, 0, 0); font-family: -webkit-standard;"><span style=";color: #373737;;caret-color: #373737; font-size: 14px; letter-spacing: 1px;"><img src="https://static.hi-best.net/upload/business/ueditor/20181101/1541051015834194.jpg" style="width:100%" alt="13_18_47__11_01_2018.jpg"/></span></p><p style="caret-color: rgb(0, 0, 0); font-family: -webkit-standard;"><span style=";color: #373737;;caret-color: #373737; font-size: 14px; letter-spacing: 1px;"><br/></span></p><p style="font-family: -webkit-standard; box-sizing: inherit; margin-bottom: 18px; display: inline-block; letter-spacing: 1px; caret-color: rgb(55, 55, 55); color: rgb(55, 55, 55); text-indent: 35px; line-height: 2em;"><span style="font-size: 14px;">公司以SS2O2B(Service&amp;Supplier to Office to Business)模式,建设和运营智慧化、共享化办公空间,满足企业快速部署、高度弹性、轻资产投入的新型办公需求。同时公司以办公空间为入口,通过内部孵化+投资并购的模式形成基础后援、政策信息、知识产权、营销资源、供需合作等企业成长要素的闭环,满足企业加速成长的各类需求,形成侠客岛里/岛外的企业间互为供需、互利共赢的人才、品牌、客户、能力的开放式生态。<br style="box-sizing: inherit;"/>公司作为主要发起人、联合国内头部共享办公运营商发起成立了全联房地产商会联合办公分会并出任执行会长,并参与发布了国内首个众创空间(联合办公)服务标准。</span></p><p><span style="color:#373737;font-family:-webkit-standard"><span style="caret-color: #373737; font-size: 14px; letter-spacing: 1px;"><br/></span></span></p><p><span style="color:#373737;font-family:-webkit-standard"><span style="caret-color: #373737; font-size: 14px; letter-spacing: 1px;"><img src="https://static.hi-best.net/upload/business/ueditor/20181101/1541051048113998.jpg" style="width:100%" alt="13_19_37__11_01_2018.jpg"/></span></span></p><p style="caret-color: rgb(0, 0, 0); font-family: -webkit-standard; line-height: 2em;"><img src="https://static.hi-best.net/upload/business/ueditor/20181101/1541050727448629.jpg" alt="11_14_08__10_16_2018.jpg" style="font-size: 14px; caret-color: rgb(55, 55, 55); color: rgb(55, 55, 55); letter-spacing: 1px; text-indent: 35px; width: 0px;"/></p><p style="font-family: -webkit-standard; box-sizing: inherit; margin-bottom: 18px; display: inline-block; letter-spacing: 1px; caret-color: rgb(55, 55, 55); color: rgb(55, 55, 55); text-indent: 35px; line-height: 2em;"><span style="font-size: 14px;">公司通过国内首创的全流程数据化空间运营平台“办公町”和旗下联合办公、严选办公、定制办公等共享办公产品,为企业提供即时按需的全生命周期(从1人到1000人,从总部到分支机构)的办公室选址、共享化空间规划设计、智慧化装修改造、数据化运营管理、一站式企业基础服务、金融服务解决方案。公司以推动写字楼和企业内部空间全面数据化、绿色化、智慧化、共享化、社交化为使命,通过共享低效办公空间,装修及运营第三方化、激发员工社交活性和创造性等手段为企业降低办公成本、提高企业运营效率、提高员工满意度。</span></p><p style="font-family: -webkit-standard; box-sizing: inherit; margin-bottom: 18px; display: inline-block; letter-spacing: 1px; caret-color: rgb(55, 55, 55); color: rgb(55, 55, 55); text-indent: 35px; line-height: 2em;"><span style="font-size: 14px;">公司旗下侠客资本通过与加州伯克利大学、中证互联等知名创新机构合作,通过投资孵化及并购形成了包括:加州伯克利CITRIS FOUNDRY中国创新中心、中证岛里金融科技加速器(金融科技领域专业加速器)、察察政策通(政策信息、规划、研究服务平台)、察察财税通(企业基础人事、财务、行政服务)、百晓商机(企业即时供需合作平台)、苹果与蛇(企业营销服务平台)、云雀智能客服(企业共享智能客户服务平台)等在内的企业加速服务生态布局。侠客资本将持续关注企业级服务平台投资机遇,以线下办公室为入口,有效协同,逐步发展壮大,形成资本链接形成企业级服务共享经济平台。</span></p><div><div style="text-indent: 35px;"><font color="#373737" face="-webkit-standard"><span style="caret-color: #373737; font-size: 14px; letter-spacing: 1px;"><br/></span></font></div><div><p><font color="#373737" face="-webkit-standard"><span style="caret-color: #373737; font-size: 14px; letter-spacing: 1px;"><img src="https://static.hi-best.net/upload/business/ueditor/20181101/1541051451924986.jpg" style="width:100%" alt="mmexport1541051394688.jpg"/></span></font></p><div><p style="font-family: -webkit-standard; box-sizing: inherit; margin-bottom: 18px; display: inline-block; letter-spacing: 1px; caret-color: rgb(55, 55, 55); color: rgb(55, 55, 55); text-indent: 35px; line-height: 2em;"><span style="font-size: 14px;"></span></p></div><p style="line-height: 2em;"><span style="font-size: 14px; caret-color: #373737; color: #373737; font-family: -webkit-standard; letter-spacing: 1px; text-indent: 35px;">&nbsp; &nbsp; &nbsp; 截止到2018年4月,公司通过自营及托管模式,与各级政府、写字楼(园区)开发商、大型企业、企业服务商、投资机构合作,建设和运营了超过20万平米、分布在一线和新一线城市(成都、北京、上海、重庆、西安、苏州、长沙)核心区的40个空间,为超过2000家企业,40000名员工提供共享办公服务,并占有了成都、重庆、苏州、西安、长沙等城市共享办公市场的绝大部分份额。旗下办公空间入住率保持90%以上,形成了舒适自在、高度客户粘性、与入驻企业共同快速成长的良好口碑。侠客资本投资合作的线上企业服务平台与线下办公空间高度协同,形成了基于线下办公数据和线上服务数据的企业画像,并以此为基础与线上、线下超过100,000家优秀企业同建设一个互为供需、互利共赢的空间、人才、品牌、客户、能力开放式生态,实现“来岛里,更成功”的企业愿景。</span></p><div><p><br/></p></div></div></div>

      这是我实际在用的一段富文本的内容

      2018-11-08
      回复
    • 谢东寅yin
      谢东寅yin
      2018-11-08回复卢霄霄

       你这段是直接后台富文本编辑的时候就搞好样式 返回来你直接用的把

      2018-11-08
      回复
    查看更多(1)
  • 卢霄霄
    卢霄霄
    2018-11-08

    直接把这串内容赋值给 rich-text 的 nodes属性就行了

    2018-11-08
    有用
    回复 2
    • 谢东寅yin
      谢东寅yin
      2018-11-08

       现在的样式只是百度富文本编辑器自带的  样式上并不满足要求

      2018-11-08
      回复
    • 卢霄霄
      卢霄霄
      2018-11-08回复谢东寅yin

      section 标签,rich-text不识别(我之前反正不识别,不知道现在好了没)。百度编辑器,样式上不够。。你可以直接用html模式自己直接写哟

      2018-11-08
      回复
登录 后发表内容