-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
传入类型是HTMLCollection,要如何解析到Omi里面? #945
Comments
import { tag, render, h, Component } from 'omi'
const markup = '<h3>Some HTML to render.</h3>'
@tag('my-element')
class MyElement extends Component {
render() {
return <div unsafeHTML={{ html: markup }}></div>
}
}
render(<my-element />, 'body') |
转成html? |
像这种情况也尝试过,但是因为类型是对象类型,并不支持这种方法,这种方式只适用于string的情况 |
在render函数里自己封装一个函数把 dom 转成 vnode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我现在获取到的数据是HTMLCollection类型的,请问要怎么样才能渲染到Omi当中的模版当中?

在React当中有类型的工具可以帮助生成,例如:html-react-parser。
请问一下Omi是否有方法或者工具可以将HTMLCollection转换成Omi特有的渲染类型?
非常感谢
The text was updated successfully, but these errors were encountered: