Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
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
ReactWeb5
wisdom-components
Commits
39e5a111
Commit
39e5a111
authored
Jan 21, 2021
by
程恺文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
描述
parent
c123836c
Pipeline
#22823
passed with stages
in 2 minutes 33 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
9 deletions
+49
-9
index.md
docs/index.md
+0
-1
Simple.js
packages/chengkaiwen_test/src/demos/Simple.js
+49
-8
No files found.
docs/index.md
View file @
39e5a111
...
...
@@ -14,4 +14,3 @@ hero:
| 组件 | 下载量 | 版本 |
| ---- | ------ | ---- |
packages/chengkaiwen_test/src/demos/Simple.js
View file @
39e5a111
...
...
@@ -2,21 +2,61 @@ import React from 'react';
import
{
Typography
,
Divider
}
from
'antd'
;
import
'./a.css'
;
const
data
=
[
'
光谷智慧园一期泵房1
'
,
'
光谷智慧园一期泵房2
'
,
'
光谷智慧园一期泵房3
'
,
'
光谷金融港一期水厂4
'
,
'
光谷金融港二期水厂5
'
,
'
列表数据第1行
'
,
'
列表数据第2行
'
,
'
列表数据第3行
'
,
'
列表数据第4行
'
,
'
列表数据第5行
'
,
];
const
color
=
[
'red'
,
'green'
,
'olive'
,
'blue'
,
'purple'
];
export
default
()
=>
{
/*export default () => {
function dianji(i,e){
alert(`您点击了第${i+1}行`)
color[i]='black'
console.log(color );
}
return (
<>
{data.map((v, i) => (
<
div
className
=
{
data
[
i
]}
title
=
{
'程恺文'
+
i
}
style
=
{{
color
:
color
[
i
]
}}
>
<div className={data[i]}
onClick={dianji.bind(this,i)}
title={'程恺文' + i} style={{ color: color[i] }}>
{i + v + '程恺文'}
</div>
))}
</>
);
};
}; */
class
B
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
data
:
[
'列表数据第1行'
,
'列表数据第2行'
,
'列表数据第3行'
,
'列表数据第4行'
,
'列表数据第5行'
,
],
color
:[
'red'
,
'green'
,
'olive'
,
'blue'
,
'purple'
],
color1
:[
'red'
,
'green'
,
'olive'
,
'blue'
,
'purple'
]}
}
dianji
=
(
i
,
e
)
=>
{
alert
(
`您点击了第
${
i
+
1
}
行`
)
if
(
this
.
state
.
color
[
i
]
==
'black'
){
this
.
state
.
color
[
i
]
=
this
.
state
.
color1
[
i
]
}
else
{
this
.
state
.
color
[
i
]
=
'black'
}
// console.log(this.state.color );
this
.
setState
({
color
:
this
.
state
.
color
})
}
render
()
{
return
(
<
div
>
{
this
.
state
.
data
.
map
((
v
,
i
)
=>
(
<
div
className
=
{
this
.
state
.
data
[
i
]}
onClick
=
{
this
.
dianji
.
bind
(
this
,
i
)}
title
=
{
'程恺文'
+
i
}
style
=
{{
color
:
this
.
state
.
color
[
i
]
}}
>
{
i
+
v
+
'程恺文'
}
<
/div
>
))}
<
/div
>
)
}
}
export
default
B
;
\ No newline at end of file
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