备份:修复前完整项目快照 2026-04-19
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import React, { useEffect } from 'react';
|
||||
|
||||
const TestPage2: React.FC = () => {
|
||||
console.log('TestPage2组件被渲染了');
|
||||
|
||||
useEffect(() => {
|
||||
console.log('TestPage2组件挂载了');
|
||||
// 测试API调用
|
||||
const testApi = async () => {
|
||||
try {
|
||||
console.log('开始测试API调用...');
|
||||
const response = await fetch('/api/users');
|
||||
console.log('响应状态:', response.status);
|
||||
const data = await response.json();
|
||||
console.log('API返回数据:', data);
|
||||
} catch (error) {
|
||||
console.error('API调用失败:', error);
|
||||
}
|
||||
};
|
||||
testApi();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div style={{ padding: 24 }}>
|
||||
<h1>测试页面</h1>
|
||||
<p>这是一个测试页面,用于检查console.log是否正常工作。</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default TestPage2;
|
||||
Reference in New Issue
Block a user