您可以创建一个刷新客户端组件并在您想要重新加载/刷新的页面中渲染
// @/components/Refresh.jsx
'use client';
import { useEffect, useRef } from 'react';
export default function Refresh({ interval }) {
const id = useRef('');
useEffect(() => {
id.current = setInterval(() => {
// add your logic here to match 12 pm with current time and then reload
window.location.reload();
}, interval);
return () => clearInterval(id.current);
}, [id.current, interval]);
return null;
}
// @/app/layout.jsx for all pages
// @/app/page.jsx for just homepage
<Refresh interval={60*1000} />