|
|
@@ -63,7 +63,7 @@ const toggleDrawer = () => {
|
|
|
// 返回上一页
|
|
|
const goBack = () => {
|
|
|
// 根据来源页面决定返回路径
|
|
|
- const fromPage = route.query.from;
|
|
|
+ const fromPage = window.history.state?.from;
|
|
|
if (fromPage === 'ai-ennumerals') {
|
|
|
router.push("/ai-ennumerals");
|
|
|
} else if (fromPage === 'ai-laboratory' || !fromPage) {
|
|
|
@@ -77,22 +77,23 @@ const goBack = () => {
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
|
|
|
-const personId = ref(route.query.id);
|
|
|
-const personName = ref(route.query.name);
|
|
|
-const personIntroduce = ref(route.query.message);
|
|
|
-const personImage = ref(route.query.image);
|
|
|
+// 从history.state获取参数
|
|
|
+const personId = ref(window.history.state?.id || '');
|
|
|
+const personName = ref(window.history.state?.name || '');
|
|
|
+const personIntroduce = ref(window.history.state?.message || '');
|
|
|
+const personImage = ref(window.history.state?.image || '');
|
|
|
|
|
|
-// 路由参数变化监听
|
|
|
+// 监听history.state变化
|
|
|
watch(
|
|
|
- () => route.query,
|
|
|
- (newQuery, oldQuery) => {
|
|
|
+ () => window.history.state,
|
|
|
+ (newState, oldState) => {
|
|
|
// 只有当id变化时才更新数据,避免不必要的刷新
|
|
|
- if (newQuery.id && newQuery.id !== oldQuery?.id) {
|
|
|
+ if (newState?.id && newState.id !== oldState?.id) {
|
|
|
// 更新相关数据
|
|
|
- personId.value = newQuery.id;
|
|
|
- personName.value = newQuery.name;
|
|
|
- personIntroduce.value = newQuery.message;
|
|
|
- personImage.value = newQuery.image;
|
|
|
+ personId.value = newState.id;
|
|
|
+ personName.value = newState.name;
|
|
|
+ personIntroduce.value = newState.message;
|
|
|
+ personImage.value = newState.image;
|
|
|
}
|
|
|
},
|
|
|
{ immediate: true, deep: true }
|