NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
https://docs.taro.zone/
Other
35.46k stars 4.78k forks source link

怎么解析HTML和markdown等文本格式,小程序是有wxParse可以用,但是Taro不晓得怎么用 #218

Closed aushion closed 6 years ago

aushion commented 6 years ago

解析HTML和markdown

zacksleo commented 6 years ago

如果是HTML,可以直接使用 <RichText nodes={this.state.nodes} /> , this.state.nodes 可以是字符串,也可以是 Array, 参考代码

128

aushion commented 6 years ago

@zacksleo 可以的,我试了的确可行,RichText可以

luckyadam commented 6 years ago

最新版本的 beta 已经支持使用 wxParse 了,这是个例子 https://github.com/NervJS/taro-components-test/blob/master/src/pages/wxParse/wxParse.js

caoleiqing commented 5 years ago

最新版本的 beta 已经支持使用 wxParse 了,这是个例子 https://github.com/NervJS/taro-components-test/blob/master/src/pages/wxParse/wxParse.js

为什么我用了以后解析不了link标签呢?

program-spiritual commented 5 years ago

我封装的一个组件 随下随用 ,欢迎star

https://github.com/xiaomiwujiecao/taroWxParse

junxinhuang21 commented 5 years ago

@zacksleo 可以的,我试了的确可行,RichText可以 但是RichText并不想wxparse那样图片自适应

jinyindu commented 5 years ago

@luckyadam 这个百度 和支付宝小程序支持吗

shryzhang commented 5 years ago

最新版本的 beta 已经支持使用 wxParse 了,这是个例子 https://github.com/NervJS/taro-components-test/blob/master/src/pages/wxParse/wxParse.js

copy代码回来,为什么加载不出来啊? image image

template这里还有报错 image

componentDidMount里可以正确拿到WxParse,求解!!控制台没有报错。 image

shryzhang commented 5 years ago

最新版本的 beta 已经支持使用 wxParse 了,这是个例子 https://github.com/NervJS/taro-components-test/blob/master/src/pages/wxParse/wxParse.js

copy代码回来,为什么加载不出来啊? image image

template这里还有报错 image

componentDidMount里可以正确拿到WxParse,求解!!控制台没有报错。 image

原因找到了: image

在componentDidMount里同时setState,wxParse就无法渲染出内容

shryzhang commented 5 years ago

最新版本的 beta 已经支持使用 wxParse 了,这是个例子 https://github.com/NervJS/taro-components-test/blob/master/src/pages/wxParse/wxParse.js

请问template forbidden怎么办!!提交代码加了pre-commit的eslint检查,这个template forbidden,commit过不了。。😭

Imagine-Tom commented 5 years ago

最新版本的 beta 已经支持使用 wxParse 了,这是个例子 https://github.com/NervJS/taro-components-test/blob/master/src/pages/wxParse/wxParse.js

请问template forbidden怎么办!!提交代码加了pre-commit的eslint检查,这个template forbidden,commit过不了。。😭

问下我也使用了你同样的组件 但是我在H5的时候会报错。说找不到wx 你那边会报错吗?

EdisonVan commented 4 years ago