katex介绍
- 将公式渲染成html标签
- 使用方法
1.node 使用
2.npm使用
npm install katex
import katex from 'katex'
katex.renderToString(xx,dom)
katex.render(xx,dom,options?:{
throwOnError: false
})
使用过程中出现的问题
公式渲染不出来
- 定位为处理成的图片地址一样导致一直从缓存中取图片
document.querySelectorAll('img').forEach(item => {
item.onerror = () => {
item.srcElement.src = item.srcElement.getAttribute('src') + '?id=' + new Date().getTime()
}
})