Skip to content

Commit dafefed

Browse files
loadchangehazel54
authored andcommitted
refactor: add render callback
1 parent 97f98a3 commit dafefed

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

site/index.jsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@ import './styles/prism.css';
1111

1212
import App from './page';
1313

14-
render(<AppContainer><App /></AppContainer>, document.getElementById('app'));
15-
16-
if (module.hot) {
17-
module.hot.accept('./page', () => {
18-
const App = require('./page').default;
19-
20-
render(<AppContainer><App /></AppContainer>, document.getElementById('app'));
21-
});
22-
}
23-
2414
function inChinaConfirm() {
2515
import('../src/message-box').then(MessageBox => {
2616
MessageBox.default.confirm('建议大陆用户访问部署在国内的站点,是否跳转?', '提示').then(() => {
@@ -41,4 +31,12 @@ function inChina() {
4131
}
4232
}
4333

44-
setTimeout(() => inChina());
34+
render(<AppContainer><App /></AppContainer>, document.getElementById('app'), inChina);
35+
36+
if (module.hot) {
37+
module.hot.accept('./page', () => {
38+
const App = require('./page').default;
39+
40+
render(<AppContainer><App /></AppContainer>, document.getElementById('app'));
41+
});
42+
}

0 commit comments

Comments
 (0)