src/util/loading/index.tsx
// 不生效
export const showLoading = () => {
const loading = document.createElement('div')
loading.setAttribute('id', 'loading')
ReactDom.createRoot(loading).render(<Loading />)
}
这样写是可以的 (已经在 index.html 中加上 <div id="loading"></div>
的前提下)
export const showLoading = () => {
const loading = document.getElementById('loading') as HTMLDivElement
ReactDom.createRoot(loading).render(<Loading />)
}
commit 是 f429de2bacf420d3c5a5a5b8216d2985db3b7b6c
希望老师能帮看下, 感谢!