taro render html
taro render html

html = `<h1 style='color: red'>Wallace is way taller than other reporters.</h1>`;
// "<h1 style='color: red'>Wallace is way taller than other reporters.</h1>"
text = html.replace(/<h1/ig, '<Text').replace(/<\/h1>/ig, '</Text>');
// "<Text style='color: red'>Wallace is way taller than other reporters.</Text>"
const html = `<h1 style='color: red'>Wallace is way taller than other reporters.</h1>`;
const htmlRender = (html = ``) => {
const text = html.replace(/<h1/ig, '<Text').replace(/<\/h1>/ig, '</Text>');
return (
<View>{text}</View>
);
}
AST parse html ???
RichText
https://nervjs.github.io/taro/docs/components/base/rich-text.html#htmlelement
https://developers.weixin.qq.com/miniprogram/dev/component/rich-text.html

const html = `<h1 style='color: red'>Wallace is way taller than other reporters.</h1>`;
const htmlRender = (html = ``) => {
const text = html.replace(/<h1/ig, '<Text').replace(/<\/h1>/ig, '</Text>');
return (
<View>{text}</View>
);
}
return (
<View className='index-box'>
<Text>index</Text>
{/* {htmlRender(html)} */}
<RichText nodes={html} />
</View>
)

const detailDesc = `<p><span style=\"font-size:18px\"><span style=\"color:#008000\">指针测试社群字段</span></span></p>\n\n<p><span style=\"font-size:18px\"><span style=\"color:#008000\"><img alt=\"\" src=\"https://o8qg9birw.qnssl.com/content/2b493805ac28efdd4c31562f52b5306256f6978c.jpg\" style=\"height:736px; width:414px\" /></span></span></p>\n`;
return (
<View className='index-box'>
<RichText nodes={detailDesc} />
</View>
)
H5 OK

alipay Error

wx ??? html tag filter

taro render html的更多相关文章
- taro 创建 Tabbar
1.代码 src/app.js import '@tarojs/async-await' import Taro, { Component } from '@tarojs/taro' import H ...
- Taro聊天室|react+taro仿微信聊天App界面|taro聊天实例
一.项目简述 taro-chatroom是基于Taro多端实例聊天项目,运用Taro+react+react-redux+taroPop+react-native等技术开发的仿微信App界面聊天室,实 ...
- 微信小程序 API
微信小程序 API https://developers.weixin.qq.com/miniprogram/dev/component/cover-view.html demo https://de ...
- 微信小程序命名规则
目录分析 src是主要的开发目录,各个文件实现功能如下所示: ├─.idea │ └─libraries ├─.temp ├─config └─src ├─assets │ └─images ├─co ...
- taro list render bug
taro list render bug 列表渲染 https://taro-docs.jd.com/taro/docs/list.html not support jsx map 垃圾微信 cons ...
- taro 不支持render中,使用函数多条件渲染
不支持render中,使用函数多条件渲染 h5不报错,但是编译成小程序时 会报错 错误写法: onRenderContent = () => { const { verified, recogn ...
- 小程序第三方框架对比 ( wepy / mpvue / taro )(转)
文章转自 https://www.cnblogs.com/Smiled/p/9806781.html 众所周知如今市面上端的形态多种多样,手机Web.ReactNative.微信小程序, 支付宝小程 ...
- Taro使用mobx做国际化小程序
效果 目前项目使用的是Taro做小程序开发框架,Taro可以集成mbox,当然一些正常的框架也可以集成mbox,只不过需要自己集成,或者用redux也可以用相同的思想实现. 思路 利用mbox act ...
- taro 报错及解决
1.解决:taro 升级到最新版(npm install -g @tarojs/cli) 错误 组件编译 组件src/pages/xxx/xxx.tsx编译失败! TypeError: callee. ...
随机推荐
- Service Mesh 在百度网盘数万后端的落地实践
https://www.infoq.cn/article/vpa6aypkizuqiijzflih
- null调整为not null default xxx,不得不注意的坑
最近碰到一个case,值得分享一下. 现象 一个DDL,将列的属性从null调整为not null default xxx, alter table slowtech.t1 modify name v ...
- 数位dp 笔记
目录 数位dp 笔记 解决的问题 & 主体思想 入门 -- windy数 绕一个弯 -- 萌数 the end? -- 恨7不成妻 小心细节 [SDOI2016]储能表 复杂度起飞 [AHOI ...
- JS小整理
禁止右键和复制 $(document).ready( function() { document.body.oncontextmenu = document.body.ondragstart = do ...
- Spring boot获取getBean
package com.job.center.quartz.common; import org.springframework.beans.BeansException; import org.sp ...
- cassandra权威指南读书笔记--监控&维护
cassandra SLF4J API记录日志,具体采用Logback实现.在终端启动cassandra时,可以向程序输入-f,就能在终端看到这个输出.Java Mangement Extension ...
- JD价格监控【docker版】
快过年了,准备买些年货,于是频繁刷购物网站对比价格,搞得还是挺头大的.我想能不能做个应用抓取实时价格并在低于预期价格后进行提醒,于是就有了本篇文章.本文主要分享怎么将本地项目打包成镜像并推送到dock ...
- c#的dllimport使用方法详解(Port API)
DllImport是System.Runtime.InteropServices命名空间下的一个属性类,其功能是提供从非托管DLL(托管/非托管是微软的.net framework中特有的概念,其中, ...
- jRating五星评级
<!DOCTYPE html> <html> <head> <title>jrating使用示例</title> <meta char ...
- 2019牛客暑期多校训练营(第四场)D-triples I
>传送门< 题意:求最少需要多少个3的倍数按位或后可以得到数字a 思路:利用3的倍数对应的二进制数的性质来先选出一个x,然后根据数字a再配一个y出来 首先,我们都知道十进制中,任意一个数只 ...