-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b328478
commit 113d4bc
Showing
3 changed files
with
125 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<template> | ||
<div class="lc-legend"> | ||
<div | ||
class="lc-legend-item" | ||
:style="{ color: item.color }" | ||
v-for="item in items" | ||
:key="item.name" | ||
@mouseenter="handelMouseenter(item)" | ||
@mouseleave="handelMouseleave(item)" | ||
@click="handelClick(item)" | ||
> | ||
<RouterLink :to="'/experiment/' + item.experiment_id"> | ||
{{ item.name }} | ||
</RouterLink> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
/** | ||
* @description: 折线图图例组件 | ||
* @file: LineChartLegend.vue | ||
* @since: 2024-02-27 15:02:13 | ||
**/ | ||
defineProps({ | ||
items: { | ||
type: Array, | ||
default: () => [] | ||
} | ||
}) | ||
// console.log('items', props.items) | ||
const emit = defineEmits(['hoverin', 'hoverout']) | ||
// ---------------------------------- 悬浮事件 ---------------------------------- | ||
const handelMouseenter = (item) => { | ||
emit('hoverin', item) | ||
} | ||
const handelMouseleave = (item) => { | ||
emit('hoverout', item) | ||
} | ||
// ---------------------------------- 点击事件 ---------------------------------- | ||
const handelClick = (item) => { | ||
emit('click', item) | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.lc-legend { | ||
max-height: 28px; | ||
min-height: 16px; | ||
@apply overflow-y-auto flex flex-wrap px-3 mb-1 gap-y-0.5 gap-x-2 leading-none text-[12px]; | ||
@apply justify-center; | ||
.lc-legend-item { | ||
@apply flex flex-shrink-0 items-center hover:brightness-75; | ||
&:before { | ||
content: ''; | ||
display: inline-block; | ||
width: 8px; | ||
height: 2px; | ||
margin-right: 4px; | ||
background-color: currentColor; | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters