Skip to content

Commit

Permalink
fix(button): resolve hover style (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeJim authored May 9, 2023
1 parent fb89987 commit 22e7c60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/button/button.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<button
v-hover="{ className: `${name}--hover` }"
:class="buttonClass"
:disabled="disabled"
:type="type"
Expand All @@ -17,10 +18,10 @@
</template>

<script lang="ts">
import { computed, toRefs, defineComponent, getCurrentInstance, h } from 'vue';
import { computed, toRefs, defineComponent, getCurrentInstance } from 'vue';
import Loading from '../loading';
import { useEmitEvent, renderContent, renderTNode, TNode } from '../shared';
import { useEmitEvent, renderContent, renderTNode, TNode, Hover } from '../shared';
import ButtonProps from './props';
import config from '../config';
import { useFormDisabled } from '../form/hooks';
Expand All @@ -31,6 +32,7 @@ const name = `${prefix}-button`;
export default defineComponent({
name,
components: { TNode, TLoading: Loading },
directives: { Hover },
props: ButtonProps,
emits: ['click'],
setup(props, context) {
Expand Down
2 changes: 1 addition & 1 deletion src/shared/hover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Hover = {
created(el: HTMLElement, binding: DirectiveBinding<BindingObj>) {
const startTime = 50;
const stayTime = 70;
const { className, active } = binding.value;
const { className, active = true } = binding.value;

if (!active) return;

Expand Down

0 comments on commit 22e7c60

Please sign in to comment.