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. ...
随机推荐
- C++ Primer Plus读书笔记(八)函数探幽
1.内联函数 inline int square(x) {return x*x} 2.引用变量 int& 中的& 不是地址运算符,就想定义指针时的char* 一样,int&指的 ...
- C++ Primer Plus读书笔记(一)开始学习C++
1.using namespace std; 注意一下命名空间的概念,不编译这句话,可能就要用 std::cout << std::endl 这种写作方式了. 这句话放在函数内部,只对该 ...
- Tensorflow-各种优化器总结与比较
优化器总结 机器学习中,有很多优化方法来试图寻找模型的最优解.比如神经网络中可以采取最基本的梯度下降法. 梯度下降法(Gradient Descent) 梯度下降法是最基本的一类优化器,目前主要分为三 ...
- JavaWeb-tomcat安装(Unsupported major.minor version 51.0/startup.bat闪退)
JavaWeb-tomcat安装(Unsupported major.minor version 51.0) 一 启动startup.bat 出错i 今天安装tomcat出错,折腾了一下午,收获了许多 ...
- left join与inner join
举例a.b表: bId bNum 1 20 2 30 aId aNum 1 10 2 20 3 30 left join以左表为准 select * from a left join b on a.a ...
- vs中python包安装教程
vs安装python很简单,只需要在vs安装包中选择python就可以了,这里使用的python3.7: 如果有了解,都知道安装python包的指令:"pip install xxx&quo ...
- 微信小程序分享之生成海报--canvas
首先看文档 了解知识点~~(https://developers.weixin.qq.com/miniprogram/dev/component/) githup:https://github.com ...
- java大数函数(附官方文档链接)
java文档 字段摘要 static BigInteger ONE BigInteger 的常量 1. static BigInteger TEN BigInt ...
- HDU - 4221 贪心
题意: 你有n个任务,每一个任务有一个完成所需时间AI,和一个截止时间BI.时间从0开始,如果完成任务的时间(设这个时间为ans)大于BI那么就会收到ans-BI的惩罚,问你完成所有这些任务你会收到的 ...
- JavaScript——浏览器检查
遍历opera中的所有方法