-
Notifications
You must be signed in to change notification settings - Fork 41
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
a275b07
commit 8eac017
Showing
9 changed files
with
131 additions
and
65 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,66 @@ | ||
<template> | ||
<div | ||
:class="[ | ||
'xg-row', | ||
{ 'xg-row__hover': $param.hoverId === props.data.uuid }, | ||
{ 'xg-row__select': $param.selectId === props.data.uuid } | ||
]" | ||
:style="{ | ||
top: `${props.data.flatIndex * rowHeight}px`, | ||
height: `${rowHeight}px`, | ||
...$styleBox.getBorderColor() | ||
}" | ||
@mouseenter="onEnter" | ||
@mouseleave="onLeave" | ||
@click="onClick" | ||
@dblclick="onDblClick" | ||
> | ||
<slot /> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import useParam from '@/composables/useParam'; | ||
import useStyle from '@/composables/useStyle'; | ||
import RowItem from '@/models/data/row'; | ||
const props = defineProps<{ data: RowItem }>(); | ||
const { rowHeight, $styleBox } = useStyle(); | ||
const { $param } = useParam(); | ||
function onEnter() { | ||
$param.hoverId = props.data.uuid; | ||
} | ||
function onLeave() { | ||
$param.hoverId = ''; | ||
} | ||
function onClick() { | ||
$param.selectId = props.data.uuid; | ||
} | ||
function onDblClick() { | ||
// 抛出 data | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.xg-row { | ||
width: 100%; | ||
position: absolute; | ||
background-color: #fafafa; | ||
overflow: hidden; | ||
border-bottom: 1px solid; | ||
box-sizing: border-box; | ||
} | ||
.xg-row.xg-row__hover { | ||
background-color: #f0f0f0; | ||
} | ||
.xg-row__select { | ||
background-color: #e0e0e0; | ||
} | ||
</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
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
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,9 @@ | ||
import useStore from '@/store'; | ||
|
||
export default () => { | ||
const store = useStore(); | ||
|
||
return { | ||
$param: store.$param | ||
}; | ||
}; |
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