Skip to content

Commit

Permalink
refactor: 🎨hover 更加合理
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyjone committed May 16, 2023
1 parent f4e5efa commit 67699ee
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion demo/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ let id = 0;
const ganttData = reactive<any>([]);
for (let i = 0; i < 15; i++) {
for (let i = 0; i < 5; i++) {
onAdd();
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@vueuse/core": "^10.0.0",
"dayjs": "^1.11.7",
"lodash": "^4.17.21",
"vue": "3.2.25"
"vue": "^3.2.47"
},
"devDependencies": {
"@changesets/cli": "^2.26.1",
Expand Down
6 changes: 4 additions & 2 deletions src/components/common/Row.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
backgroundColor: props.renderStyle ? ($styleBox.levelColor[props.data!.level] ?? undefined) : undefined,
...$styleBox.getBorderColor()
}"
@pointerenter.stop="onEnter"
@pointerleave.stop="onLeave"
@mouseenter.capture="onEnter"
@mouseleave="onLeave"
@click="onClick"
@dblclick="onDblClick"
>
Expand All @@ -47,6 +47,8 @@ function onEnter() {
}
function onLeave() {
if (!props.renderStyle) return;
$param.hoverItem = null;
}
Expand Down
14 changes: 14 additions & 0 deletions src/composables/useParam.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
// import type RowItem from '@/models/data/row';
import useStore from '@/store';
// import { computed, ref } from 'vue';

// const _hoverItem = ref<RowItem | null>(null);

export default () => {
const store = useStore();

// const hoverItem = computed<RowItem>(() => _hoverItem.value as RowItem);
// const setHover = (item: RowItem | null) => {
// console.log('setHover', item);

// _hoverItem.value = item;
// };

return {
$param: store.$param

// hoverItem,
// setHover
};
};

0 comments on commit 67699ee

Please sign in to comment.