Skip to content

Commit e5919b0

Browse files
committed
chore(tooltip): eslint format
1 parent 3b0b7c0 commit e5919b0

File tree

3 files changed

+32
-29
lines changed

3 files changed

+32
-29
lines changed

packages/component/component/tooltip/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { withInstall } from "../../utils";
1+
import { withInstall } from "@layui/component/utils";
22
import Component from "./index.vue";
33

44
const component = withInstall(Component);

packages/component/component/tooltip/index.vue

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<script lang="ts" setup>
2-
import "./index.less";
3-
4-
import type { TooltipProps } from "./types";
52
import type {
63
PopperTrigger as _PopperTrigger,
7-
Placement,
84
ContentComponentInstance,
5+
Placement,
96
} from "../popper/index";
107
11-
import LayPopper from "../popper/popper.vue";
12-
import { computed, nextTick, onMounted, ref, shallowRef, unref } from "vue";
8+
import type { TooltipProps } from "./types";
139
import {
1410
useEventListener,
15-
useResizeObserver,
1611
useMutationObserver,
12+
useResizeObserver,
1713
} from "@vueuse/core";
1814
15+
import { computed, nextTick, onMounted, ref, shallowRef, unref } from "vue";
16+
import LayPopper from "../popper/popper.vue";
17+
import "./index.less";
18+
1919
export type PopperTrigger = _PopperTrigger;
2020
2121
defineOptions({
@@ -52,21 +52,23 @@ const popperProps = computed(() => {
5252
};
5353
});
5454
55-
const setEllipsis = function () {
55+
function setEllipsis() {
5656
if (tooltipRef.value) {
57-
let tooltipHtml = tooltipRef.value;
57+
const tooltipHtml = tooltipRef.value;
5858
if (
59-
tooltipHtml.scrollWidth > tooltipHtml.clientWidth ||
60-
tooltipHtml.scrollHeight > tooltipHtml.clientHeight
59+
tooltipHtml.scrollWidth > tooltipHtml.clientWidth
60+
|| tooltipHtml.scrollHeight > tooltipHtml.clientHeight
6161
) {
6262
disabledPopper.value = false;
63-
} else {
63+
}
64+
else {
6465
disabledPopper.value = true;
6566
}
66-
} else {
67+
}
68+
else {
6769
disabledPopper.value = false;
6870
}
69-
};
71+
}
7072
7173
onMounted(() => {
7274
if (props.isAutoShow) {
@@ -89,40 +91,41 @@ onMounted(() => {
8991
});
9092
});
9193
92-
const show = function () {
94+
function show() {
9395
nextTick(() => {
9496
popperRef.value!.show();
9597
});
96-
};
98+
}
9799
98-
const doHidden = function () {
100+
function doHidden() {
99101
nextTick(() => {
100102
popperRef.value!.hidden();
101103
});
102-
};
104+
}
103105
104-
const update = function () {
106+
function update() {
105107
nextTick(() => {
106108
popperRef.value!.update();
107109
});
108-
};
110+
}
109111
110112
defineExpose({ show, hide: doHidden, update });
111113
</script>
114+
112115
<template>
113-
<lay-popper ref="popperRef" v-bind="popperProps">
114-
<div ref="tooltipRef" v-if="isAutoShow" class="lay-tooltip-content">
116+
<LayPopper ref="popperRef" v-bind="popperProps">
117+
<div v-if="isAutoShow" ref="tooltipRef" class="lay-tooltip-content">
115118
<span>
116-
<slot></slot>
119+
<slot />
117120
</span>
118121
</div>
119-
<slot v-else></slot>
122+
<slot v-else />
120123
<template #content>
121124
<slot name="content">
122125
<span v-if="content">
123126
{{ content }}
124127
</span>
125128
</slot>
126129
</template>
127-
</lay-popper>
130+
</LayPopper>
128131
</template>

packages/component/component/tooltip/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { StyleValue, TeleportProps } from "vue";
2-
import type { PopperTrigger, Placement } from "../popper/index";
2+
import type { Placement, PopperTrigger } from "../popper/index";
33

4-
export type TooltipProps = {
4+
export interface TooltipProps {
55
content?: number | string;
66
position?: Placement;
77
isDark?: boolean;
@@ -13,4 +13,4 @@ export type TooltipProps = {
1313
popperClass?: string | Array<string>;
1414
popperStyle?: StyleValue;
1515
teleportProps?: TeleportProps;
16-
};
16+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy