We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
svg
let mD = <svg width="300" height="300"> <rect bindtap="tapHandler" x="0" y="0" height="110" width="110" style="stroke:#ff0000; fill: #0000ff" /> <rect bindtap="tapHandler" x="0" y="0" height="110" width="110" style="stroke:#ff0000; fill: #0000ff" /> </svg>; const svg = renderSVG(html${mD}, 'svg-a', this) console.log('children:' + svg.children.length)
<svg width="300" height="300"> <rect bindtap="tapHandler" x="0" y="0" height="110" width="110" style="stroke:#ff0000; fill: #0000ff" /> <rect bindtap="tapHandler" x="0" y="0" height="110" width="110" style="stroke:#ff0000; fill: #0000ff" /> </svg>
${mD}
为什么我使用这种方式加载svg,无法渲染svg。因为项目需要加载外部svg
The text was updated successfully, but these errors were encountered:
是的。这样不行,因为这样解不出虚拟节点。https://github.com/developit/htm
需要:
html`<svg>xxxx</svg>`
当然你也可以 hypescript 的方式加载和书写。
h('svg', xxx, xxx)
Sorry, something went wrong.
是的。这样不行,因为这样解不出虚拟节点。https://github.com/developit/htm 需要: html`<svg>xxxx</svg>` 当然你也可以 hypescript 的方式加载和书写。 h('svg', xxx, xxx)
请问下,为什么我这样做不行呢?原理是什么呢?还有就是采用hypescript的方式可以在小程序里面使用吗?
可以深入学习下 template string https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/template_strings
感谢解答
No branches or pull requests
let mD =
<svg width="300" height="300"> <rect bindtap="tapHandler" x="0" y="0" height="110" width="110" style="stroke:#ff0000; fill: #0000ff" /> <rect bindtap="tapHandler" x="0" y="0" height="110" width="110" style="stroke:#ff0000; fill: #0000ff" /> </svg>
;const svg = renderSVG(html
${mD}
, 'svg-a', this)console.log('children:' + svg.children.length)
为什么我使用这种方式加载svg,无法渲染svg。因为项目需要加载外部svg
The text was updated successfully, but these errors were encountered: