Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
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
JIRA
JIRA
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
黄瑜
VueElementTemplate
Commits
3b89cde5
Commit
3b89cde5
authored
7 years ago
by
Pan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: echarts addEventListener about resize
parent
59e240eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
barChart.vue
src/views/dashboard/admin/barChart.vue
+8
-0
pieChart.vue
src/views/dashboard/admin/pieChart.vue
+9
-0
No files found.
src/views/dashboard/admin/barChart.vue
View file @
3b89cde5
...
...
@@ -5,6 +5,7 @@
<
script
>
import
echarts
from
'echarts'
require
(
'echarts/theme/macarons'
)
// echarts 主题
import
{
debounce
}
from
'@/utils'
const
animationDuration
=
3000
export
default
{
...
...
@@ -29,11 +30,18 @@ export default {
},
mounted
()
{
this
.
initChart
()
this
.
__resizeHanlder
=
debounce
(()
=>
{
if
(
this
.
chart
)
{
this
.
chart
.
resize
()
}
},
100
)
window
.
addEventListener
(
'resize'
,
this
.
__resizeHanlder
)
},
beforeDestroy
()
{
if
(
!
this
.
chart
)
{
return
}
window
.
removeEventListener
(
'resize'
,
this
.
__resizeHanlder
)
this
.
chart
.
dispose
()
this
.
chart
=
null
},
...
...
This diff is collapsed.
Click to expand it.
src/views/dashboard/admin/pieChart.vue
View file @
3b89cde5
...
...
@@ -5,6 +5,7 @@
<
script
>
import
echarts
from
'echarts'
require
(
'echarts/theme/macarons'
)
// echarts 主题
import
{
debounce
}
from
'@/utils'
export
default
{
props
:
{
...
...
@@ -28,11 +29,18 @@ export default {
},
mounted
()
{
this
.
initChart
()
this
.
__resizeHanlder
=
debounce
(()
=>
{
if
(
this
.
chart
)
{
this
.
chart
.
resize
()
}
},
100
)
window
.
addEventListener
(
'resize'
,
this
.
__resizeHanlder
)
},
beforeDestroy
()
{
if
(
!
this
.
chart
)
{
return
}
window
.
removeEventListener
(
'resize'
,
this
.
__resizeHanlder
)
this
.
chart
.
dispose
()
this
.
chart
=
null
},
...
...
@@ -60,6 +68,7 @@ export default {
name
:
'WEEKLY WRITE ARTICLES'
,
type
:
'pie'
,
roseType
:
'radius'
,
radius
:
[
10
,
90
],
data
:
[
{
value
:
320
,
name
:
'industries'
},
{
value
:
240
,
name
:
'technology'
},
...
...
This diff is collapsed.
Click to expand it.
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