Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
najiu-frontend
najiu-admin-template
Commits
fb6c76db
Commit
fb6c76db
authored
Jun 04, 2021
by
无木
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(echarts): add getInstance for useECharts
为useECharts添加getInstance以便绑定事件或执行更多自定义动作
parent
46899aa3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
useECharts.ts
src/hooks/web/useECharts.ts
+16
-10
No files found.
src/hooks/web/useECharts.ts
View file @
fb6c76db
...
@@ -23,8 +23,7 @@ export function useECharts(
...
@@ -23,8 +23,7 @@ export function useECharts(
resizeFn
=
useDebounceFn
(
resize
,
200
);
resizeFn
=
useDebounceFn
(
resize
,
200
);
const
getOptions
=
computed
(
const
getOptions
=
computed
(():
EChartsOption
=>
{
():
EChartsOption
=>
{
if
(
getDarkMode
.
value
!==
'
dark
'
)
{
if
(
getDarkMode
.
value
!==
'
dark
'
)
{
return
cacheOptions
.
value
;
return
cacheOptions
.
value
;
}
}
...
@@ -32,8 +31,7 @@ export function useECharts(
...
@@ -32,8 +31,7 @@ export function useECharts(
backgroundColor
:
'
transparent
'
,
backgroundColor
:
'
transparent
'
,
...
cacheOptions
.
value
,
...
cacheOptions
.
value
,
};
};
}
});
);
function
initCharts
(
t
=
theme
)
{
function
initCharts
(
t
=
theme
)
{
const
el
=
unref
(
elRef
);
const
el
=
unref
(
elRef
);
...
@@ -100,9 +98,17 @@ export function useECharts(
...
@@ -100,9 +98,17 @@ export function useECharts(
chartInstance
=
null
;
chartInstance
=
null
;
});
});
function
getInstance
():
echarts
.
ECharts
|
null
{
if
(
!
chartInstance
)
{
initCharts
(
getDarkMode
.
value
as
'
default
'
);
}
return
chartInstance
;
}
return
{
return
{
setOptions
,
setOptions
,
resize
,
resize
,
echarts
,
echarts
,
getInstance
,
};
};
}
}
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