超管后台 - 将整个前端部分页面处理id的方式,由使用 params.id 的方式全部迁移到 React.use(params) 这种方式
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import type React from "react"
|
||||
import { useState, useEffect } from "react"
|
||||
import { useState, useEffect, use } from "react"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Input } from "@/components/ui/input"
|
||||
@@ -18,7 +18,7 @@ interface Device {
|
||||
}
|
||||
|
||||
export default function EditProjectPage({ params }: { params: { id: string } }) {
|
||||
const id = params.id
|
||||
const { id } = use(params)
|
||||
|
||||
const router = useRouter()
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useState } from "react"
|
||||
import { useState, use } from "react"
|
||||
import Link from "next/link"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
@@ -31,6 +31,8 @@ const projectData = {
|
||||
}
|
||||
|
||||
export default function ProjectDetailPage({ params }: { params: { id: string } }) {
|
||||
const { id } = use(params)
|
||||
|
||||
const [activeTab, setActiveTab] = useState("overview")
|
||||
|
||||
return (
|
||||
@@ -45,7 +47,7 @@ export default function ProjectDetailPage({ params }: { params: { id: string } }
|
||||
<h1 className="text-2xl font-bold">{projectData.name}</h1>
|
||||
</div>
|
||||
<Button asChild>
|
||||
<Link href={`/dashboard/projects/${params.id}/edit`}>
|
||||
<Link href={`/dashboard/projects/${id}/edit`}>
|
||||
<Edit className="mr-2 h-4 w-4" /> 编辑项目
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user