我正在开发 NextJs 项目,我想知道安装了哪个 NextJs 版本。我可以在哪里检查?
Console.log() 总是返回 5,所以基本上在前端我总是看到这句话:欢迎,您已成功登录,您将被重定向到.. 4
看起来因为 setRedirectSeconds() 是异步的,所以它目前不会更新状态,并且每当我的 setInterval 函数再次启动时,redirectSeconds 每次仍将是 5。
如何解决这个问题?
这是我的代码:
const Welcome: NextPage = (): ReactElement => {
const [redirectSeconds, setRedirectSeconds] = useState<number>(5);
const router = useRouter();
const query = router.query;
useEffect(() => {
if (query?.redirect) {
setTimeout(() => {
const interval = setInterval(() => {
console.log(redirectSeconds);
if (redirectSeconds > 0) {
setRedirectSeconds(redirectSeconds - 1);
} else {
clearInterval(interval);
router.push(query.redirect.toString());
}
}, 1000)
}, …Run Code Online (Sandbox Code Playgroud) 当我在 Ubuntu 18 上使用 PhpStorm 打开项目时,当我尝试编辑文件时,会出现弹出窗口“清除只读状态”,并带有选项“清除 - 确定”。
当我单击清除时,再次出现弹出窗口,其中显示文本“无法更改以下文件的只读状态:...”
我无法在 Ubuntu 上更改克隆存储库(我通过 PhpStorm 访问的存储库)中的权限,因为文件权限将与在线存储库上的文件权限不同。
我可以使用 cli 通过 cli 编辑和写入文件sudo nano ..。
How can I customize Laravel ResourceCollection meta and links information.
Links should include only prev,next and self instead of first,last,prev,next that is by default.
Meta should include pagination iformation like: current_page, total_items, items_per_page, total_pages instead of current_page, from, last_page, path, per_page, to, total.
This is how meta and links information looks now in JSON response:
"meta": {
"currentPage": 2,
"current_page": 1,
"from": 1,
"last_page": 3,
"path": "http://localhost:8000/api",
"per_page": 5,
"to": 5,
"total": 14
},
"links": {
"self": "http://localhost:8000/api",
"first": "http://localhost:8000/api?page=1", …Run Code Online (Sandbox Code Playgroud) next.js ×2
reactjs ×2
eloquent ×1
laravel ×1
laravel-5.6 ×1
package.json ×1
php ×1
phpstorm ×1
ubuntu-18.04 ×1
version ×1