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的更多相关文章

  1. taro 创建 Tabbar

    1.代码 src/app.js import '@tarojs/async-await' import Taro, { Component } from '@tarojs/taro' import H ...

  2. Taro聊天室|react+taro仿微信聊天App界面|taro聊天实例

    一.项目简述 taro-chatroom是基于Taro多端实例聊天项目,运用Taro+react+react-redux+taroPop+react-native等技术开发的仿微信App界面聊天室,实 ...

  3. 微信小程序 API

    微信小程序 API https://developers.weixin.qq.com/miniprogram/dev/component/cover-view.html demo https://de ...

  4. 微信小程序命名规则

    目录分析 src是主要的开发目录,各个文件实现功能如下所示: ├─.idea │ └─libraries ├─.temp ├─config └─src ├─assets │ └─images ├─co ...

  5. taro list render bug

    taro list render bug 列表渲染 https://taro-docs.jd.com/taro/docs/list.html not support jsx map 垃圾微信 cons ...

  6. taro 不支持render中,使用函数多条件渲染

    不支持render中,使用函数多条件渲染 h5不报错,但是编译成小程序时 会报错 错误写法: onRenderContent = () => { const { verified, recogn ...

  7. 小程序第三方框架对比 ( wepy / mpvue / taro )(转)

    文章转自  https://www.cnblogs.com/Smiled/p/9806781.html 众所周知如今市面上端的形态多种多样,手机Web.ReactNative.微信小程序, 支付宝小程 ...

  8. Taro使用mobx做国际化小程序

    效果 目前项目使用的是Taro做小程序开发框架,Taro可以集成mbox,当然一些正常的框架也可以集成mbox,只不过需要自己集成,或者用redux也可以用相同的思想实现. 思路 利用mbox act ...

  9. taro 报错及解决

    1.解决:taro 升级到最新版(npm install -g @tarojs/cli) 错误 组件编译 组件src/pages/xxx/xxx.tsx编译失败! TypeError: callee. ...

随机推荐

  1. CQOI 2006 简单题

    CQOI 2006 简单题 有一个 n 个元素的数组,每个元素初始均为 0.有 m 条指令,要么让其中一段连续序列数字反转--0 变 1,1 变 0(操作 11),要么询问某个元素的值(操作 2). ...

  2. (一)Spring-Boot-操作-Redis

    Spring-Boot-操作-Redis 1.Spring Data Redis 1.1 引入依赖 1.2 配置 Redis 信息 1.3 使用 2.Spring Cache 2.1 引入依赖 2.2 ...

  3. MySQL索引的原理,B+树、聚集索引和二级索引

    MySQL索引的原理,B+树.聚集索引和二级索引的结构分析 一.索引类型 1.1 B树 1.2 B+树 1.3 哈希索引 1.4 聚集索引(clusterd index) 1.5 二级索引(secon ...

  4. Redis 实战 —— 14. Redis 的 Lua 脚本编程

    简介 Redis 从 2.6 版本开始引入使用 Lua 编程语言进行的服务器端脚本编程功能,这个功能可以让用户直接在 Redis 内部执行各种操作,从而达到简化代码并提高性能的作用. P248 在不编 ...

  5. SQL中字符串截取函数(SUBSTRING)

    1.left(name,4)截取左边的4个字符 列: SELECT LEFT(201809,4) 年 结果:2018 2.right(name,2)截取右边的2个字符 SELECT RIGHT(201 ...

  6. Preliminaries for Benelux Algorithm Programming Contest 2019

    A. Architecture 如果行最大值中的最大值和列最大值中的最大值不同的话,那么一定会产生矛盾,可以手模一个样例看看. 当满足行列最大值相同条件的时候,就可以判定了. 因为其余的地方一定可以构 ...

  7. 2019牛客暑期多校训练营(第九场)B Quadratic equation (平方剩余)

    \((x+y)\equiv b\pmod p\) \((x\times y)\equiv c\pmod p\) 由第一个式子可知:\(x+y=b~or~x+y=b+p\) 先任选一个代入到第二个式子里 ...

  8. Codeforces Round #625 (Div. 2, based on Technocup 2020 Final Round) D. Navigation System(有向图,BFS,最短路)

    题意: n 点 m 边有向图,给出行走路径,求行走途中到路径终点最短路变化次数的最小值和最大值 . 思路 : 逆向广搜,正向模拟. #include <bits/stdc++.h> usi ...

  9. Codeforces Round #649 (Div. 2) A. XXXXX

    题目链接:https://codeforces.com/contest/1364/problem/A 题意 找出大小为 $n$ 的数组 $a$ 的最长连续子数组,其元素和不被 $x$ 整除. 题解 如 ...

  10. poj1066 线段相交简单应用(解题报告)

    #include<stdio.h> #include<math.h> const double eps=1e-8; int n; struct Point { double x ...