diff --git a/components/StarrySky.js b/components/StarrySky.js
index 5479df93..e0fd3ac4 100644
--- a/components/StarrySky.js
+++ b/components/StarrySky.js
@@ -1,23 +1,24 @@
/* eslint-disable */
-import React from 'react'
+import { useEffect } from 'react'
const StarrySky = () => {
- React.useEffect(() => {
- dark()
+ useEffect(() => {
+ renderStarrySky()
}, [])
return (
-
+
)
}
export default StarrySky
+
/**
* 创建星空雨
* @param config
*/
-function dark() {
+function renderStarrySky() {
window.requestAnimationFrame =
window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
@@ -124,7 +125,7 @@ function dark() {
u()
})(),
(function t() {
- document.getElementsByTagName('html')[0].className == 'dark' && u(),
+ document.getElementsByTagName('html')[0].className.indexOf('dark')>=0 && u(),
window.requestAnimationFrame(t)
})()
}