Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-blocks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
pro-blocks
Commits
5ade2230
Commit
5ade2230
authored
Jan 08, 2018
by
nikogu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. fixed TagCloud unmount setState
2. fixed PageHeader key warning 3. fixed MiniArea key warning
parent
cfced55c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
9 deletions
+36
-9
src/components/Charts/MiniArea/index.js
src/components/Charts/MiniArea/index.js
+18
-2
src/components/Charts/TagCloud/index.js
src/components/Charts/TagCloud/index.js
+17
-6
src/layouts/PageHeaderLayout.js
src/layouts/PageHeaderLayout.js
+1
-1
No files found.
src/components/Charts/MiniArea/index.js
View file @
5ade2230
...
@@ -56,8 +56,24 @@ export default class MiniArea extends React.Component {
...
@@ -56,8 +56,24 @@ export default class MiniArea extends React.Component {
data
=
{
data
}
data
=
{
data
}
padding
=
{
padding
}
padding
=
{
padding
}
>
>
<
Axis
name
=
"
x
"
label
=
{
false
}
line
=
{
false
}
tickLine
=
{
false
}
grid
=
{
false
}
{...
xAxis
}
/
>
<
Axis
<
Axis
name
=
"
y
"
label
=
{
false
}
line
=
{
false
}
tickLine
=
{
false
}
grid
=
{
false
}
{...
yAxis
}
/
>
key
=
"
axis-x
"
name
=
"
x
"
label
=
{
false
}
line
=
{
false
}
tickLine
=
{
false
}
grid
=
{
false
}
{...
xAxis
}
/
>
<
Axis
key
=
"
axis-y
"
name
=
"
y
"
label
=
{
false
}
line
=
{
false
}
tickLine
=
{
false
}
grid
=
{
false
}
{...
yAxis
}
/
>
<
Tooltip
showTitle
=
{
false
}
crosshairs
=
{
false
}
/
>
<
Tooltip
showTitle
=
{
false
}
crosshairs
=
{
false
}
/
>
<
Geom
<
Geom
type
=
"
area
"
type
=
"
area
"
...
...
src/components/Charts/TagCloud/index.js
View file @
5ade2230
...
@@ -31,6 +31,7 @@ class TagCloud extends Component {
...
@@ -31,6 +31,7 @@ class TagCloud extends Component {
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
this
.
isUnmount
=
true
;
window
.
removeEventListener
(
'
resize
'
,
this
.
resize
);
window
.
removeEventListener
(
'
resize
'
,
this
.
resize
);
}
}
...
@@ -87,18 +88,14 @@ class TagCloud extends Component {
...
@@ -87,18 +88,14 @@ class TagCloud extends Component {
const
h
=
height
*
4
;
const
h
=
height
*
4
;
const
w
=
this
.
root
.
offsetWidth
*
4
;
const
w
=
this
.
root
.
offsetWidth
*
4
;
const
imageMask
=
new
Image
();
const
onload
=
()
=>
{
imageMask
.
crossOrigin
=
''
;
imageMask
.
src
=
imgUrl
;
imageMask
.
onload
=
()
=>
{
const
dv
=
new
DataSet
.
View
().
source
(
data
);
const
dv
=
new
DataSet
.
View
().
source
(
data
);
const
range
=
dv
.
range
(
'
value
'
);
const
range
=
dv
.
range
(
'
value
'
);
const
[
min
,
max
]
=
range
;
const
[
min
,
max
]
=
range
;
dv
.
transform
({
dv
.
transform
({
type
:
'
tag-cloud
'
,
type
:
'
tag-cloud
'
,
fields
:
[
'
name
'
,
'
value
'
],
fields
:
[
'
name
'
,
'
value
'
],
imageMask
,
imageMask
:
this
.
imageMask
,
font
:
'
Verdana
'
,
font
:
'
Verdana
'
,
size
:
[
w
,
h
],
// 宽高设置最好根据 imageMask 做调整
size
:
[
w
,
h
],
// 宽高设置最好根据 imageMask 做调整
padding
:
5
,
padding
:
5
,
...
@@ -112,12 +109,26 @@ class TagCloud extends Component {
...
@@ -112,12 +109,26 @@ class TagCloud extends Component {
},
},
});
});
if
(
this
.
isUnmount
)
{
return
;
}
this
.
setState
({
this
.
setState
({
dv
,
dv
,
w
,
w
,
h
,
h
,
});
});
};
};
if
(
!
this
.
imageMask
)
{
this
.
imageMask
=
new
Image
();
this
.
imageMask
.
crossOrigin
=
''
;
this
.
imageMask
.
src
=
imgUrl
;
this
.
imageMask
.
onload
=
onload
;
}
else
{
onload
();
}
};
};
render
()
{
render
()
{
...
...
src/layouts/PageHeaderLayout.js
View file @
5ade2230
...
@@ -6,7 +6,7 @@ import styles from './PageHeaderLayout.less';
...
@@ -6,7 +6,7 @@ import styles from './PageHeaderLayout.less';
export
default
({
children
,
wrapperClassName
,
top
,
...
restProps
})
=>
(
export
default
({
children
,
wrapperClassName
,
top
,
...
restProps
})
=>
(
<
div
style
=
{{
margin
:
'
-24px -24px 0
'
}}
className
=
{
wrapperClassName
}
>
<
div
style
=
{{
margin
:
'
-24px -24px 0
'
}}
className
=
{
wrapperClassName
}
>
{
top
}
{
top
}
<
PageHeader
{...
restProps
}
linkElement
=
{
Link
}
/
>
<
PageHeader
key
=
"
pageheader
"
{...
restProps
}
linkElement
=
{
Link
}
/
>
{
children
?
<
div
className
=
{
styles
.
content
}
>
{
children
}
<
/div> : null
}
{
children
?
<
div
className
=
{
styles
.
content
}
>
{
children
}
<
/div> : null
}
<
/div
>
<
/div
>
);
);
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