Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
react-test-project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
test
react-test-project
Commits
21027599
Commit
21027599
authored
Apr 10, 2020
by
陈俊尹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新需求内容.
parent
55f7fbf5
Pipeline
#10
failed with stages
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
89 deletions
+31
-89
README.md
README.md
+9
-4
index.html
public/index.html
+1
-4
res.json
public/res.json
+15
-1
App.tsx
src/component/App.tsx
+1
-8
ChildComponent.tsx
src/component/ChildComponent.tsx
+0
-27
AppFunction.ts
src/function/AppFunction.ts
+0
-32
webpack.config.js
webpack.config.js
+5
-13
No files found.
README.md
View file @
21027599
## 测试项目
###
1.
需求实现
### 需求实现
-
App 组件内,
实现 Icon 跟随鼠标移动.
-
App 组件内,
在组件挂载完成后, 发起网络请求获取接口数据 并定义数据结构 url: '/public/res.json'
### 2. 函数修改
-
根据网络请求结果进行组件渲染.
-
改进 AppFunction.ts 内 foo 方法的实现.
\ No newline at end of file
components
| type | 说明 |
| ---- | ---- |
| img | 渲染图片组件 |
| text | 渲染文本内容 |
public/index.html
View file @
21027599
...
...
@@ -21,9 +21,6 @@
-webkit-tap-highlight-color
:
rgba
(
255
,
255
,
255
,
0
);
}
#react-test-project
{
margin
:
80px
;
}
</style>
</head>
...
...
public/res.json
View file @
21027599
{
"title"
:
"title"
"title"
:
"title"
,
"components"
:
[
{
"type"
:
"image"
,
"data"
:
"/test-assets/fp100-raw/R0012129/thumb.jpg"
},
{
"type"
:
"image"
,
"data"
:
"/test-assets/fp100-raw/R0012133/thumb.jpg"
},
{
"type"
:
"text"
,
"data"
:
"hello world"
}
]
}
src/component/App.tsx
View file @
21027599
...
...
@@ -6,8 +6,6 @@
import
'antd/dist/antd.css'
;
import
*
as
React
from
'react'
;
import
{
Icon
}
from
'antd'
;
import
{
ChildComponent
}
from
'./ChildComponent'
;
interface
AppProps
{
}
...
...
@@ -23,13 +21,8 @@ export class App extends React.Component<AppProps, AppState> {
}
render
()
{
const
children
=
[];
for
(
let
i
=
0
;
i
<
5000
;
i
++
)
{
children
.
push
(<
ChildComponent
index=
{
i
}
key=
{
i
}
/>);
}
return
<
div
>
<
Icon
type=
"fullscreen-exit"
/>
{
children
}
App
</
div
>;
}
}
src/component/ChildComponent.tsx
deleted
100644 → 0
View file @
55f7fbf5
/**
* 子组件
* @author uglyer
* @date 2020/1/7 9:45
*/
import
*
as
React
from
'react'
;
import
{}
from
'antd'
;
interface
ChildComponentProps
{
index
:
number
;
}
interface
ChildComponentState
{
}
export
class
ChildComponent
extends
React
.
Component
<
ChildComponentProps
,
ChildComponentState
>
{
constructor
(
props
:
ChildComponentProps
)
{
super
(
props
);
this
.
state
=
{};
}
render
()
{
return
<
div
>
ChildComponent:
{
this
.
props
.
index
}
</
div
>;
}
}
src/function/AppFunction.ts
deleted
100644 → 0
View file @
55f7fbf5
/**
* 常用方法
* @author uglyer
* @date 2020/1/7 9:24
*/
/**
* 一个需要被改进的方法
* @param test1 测试参数
* @param handler 函数被正常执行结束回调
*/
function
foo
(
test1
:
{
foo
?:
number
,
foo2
?:
(
index
:
number
,
fooValue
:
number
)
=>
void
},
handler
:
()
=>
void
)
{
if
(
test1
)
{
if
(
test1
.
foo
)
{
if
(
test1
.
foo2
)
{
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
test1
.
foo2
(
i
,
test1
.
foo
);
// do something A
}
if
(
handler
)
{
handler
();
}
}
else
{
// do something B
}
}
else
{
// do something C
}
}
else
{
// do something D
}
}
webpack.config.js
View file @
21027599
...
...
@@ -108,7 +108,7 @@ module.exports = {
devServer
:
{
contentBase
:
path
.
join
(
__dirname
,
'./'
),
compress
:
true
,
port
:
779
9
,
port
:
779
8
,
useLocalIp
:
true
,
host
:
'0.0.0.0'
,
overlay
:
true
,
...
...
@@ -121,16 +121,8 @@ module.exports = {
]
},
proxy
:
{
'/api'
:
{
target
:
'http://police.reality3d.cn'
,
changeOrigin
:
true
},
'/file'
:
{
target
:
'http://police.reality3d.cn'
,
changeOrigin
:
true
},
'/map'
:
{
target
:
'http://127.0.0.1:5000'
,
'/test-assets'
:
{
target
:
'http://nas.reality3d.cn:30002'
,
changeOrigin
:
true
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment