8000 fix: lint · vueuse/vueuse@93bb221 · GitHub
[go: up one dir, main page]

Skip to content

Commit 93bb221

Browse files
committed
fix: lint
1 parent 2d609da commit 93bb221

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

packages/core/useElementOverflow/component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import { type RenderableComponent, useElementOverflow, type UseElementOverflowOptions } from '@vueuse/core'
2-
import { defineComponent, h, reactive, ref } from 'vue'
1+
import type { RenderableComponent, UseElementOverflowOptions } from '@vueuse/core'
2+
import { useElementOverflow } from '@vueuse/core'
3+
import { defineComponent, h, reactive, shallowRef } from 'vue'
34

45
export const UseElementOverflow = /* #__PURE__ */ defineComponent<UseElementOverflowOptions & RenderableComponent>({
56
name: 'UseElementOverflow',
67
props: ['observeMutation', 'as'] as unknown as undefined,
78
emits: ['update'],
89
setup(props, { slots, attrs, emit }) {
9-
const target = ref()
10+
const target = shallowRef()
1011
const info = reactive(useElementOverflow(target, {
1112
observeMutation: props.observeMutation,
1213
onUpdated: (...args: any[]) => { emit('update', ...args) },

packages/core/useElementOverflow/demo.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<script setup lang="ts">
2-
import { ref } from 'vue'
2+
import { shallowRef } from 'vue'
33
import { useElementOverflow } from './index'
44
5-
const overflowRef = ref()
5+
const overflowRef = shallowRef()
66
const { isXOverflowed } = useElementOverflow(overflowRef, { observeMutation: true })
7-
const input = ref('some words here')
8-
const width = ref(200)
7+
const input = shallowRef('some words here')
8+
const width = shallowRef(200)
99
</script>
1010

1111
<template>

packages/core/useElementOverflow/directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { ObjectDirective } from 'vue'
2+
import type { UseElementOverflowOptions, UseElementOverflowReturn } from '.'
23
import { watch } from 'vue'
3-
import { useElementOverflow, type UseElementOverflowOptions, type UseElementOverflowReturn } from '.'
4+
import { useElementOverflow } from '.'
45

56
type VElementOverflowHandler = (info: UseElementOverflowReturn) => void
67

packages/core/useElementOverflow/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import type { ConfigurableWindow } from '@vueuse/core/_configurable'
2+
import type { MaybeComputedElementRef } from '../unrefElement'
23
import type { ResizeObserverCallback } from '../useResizeObserver'
34
import {
45
tryOnMounted,
56
tryOnUnmounted,
67
} from '@vueuse/shared'
7-
import { effectScope, ref } from 'vue'
8+
import { effectScope, shallowRef } from 'vue'
89
import { defaultWindow } from '../_configurable'
9-
import { type MaybeComputedElementRef, unrefElement } from '../unrefElement'
10+
import { unrefElement } from '../unrefElement'
1011
import { useMutationObserver } from '../useMutationObserver'
1112
import { useResizeObserver } from '../useResizeObserver'
1213

@@ -31,8 +32,8 @@ export interface UseElementOverflowOptions extends ConfigurableWindow {
3132
*/
3233
export function useElementOverflow(target: MaybeComputedElementRef, option: UseElementOverflowOptions = {}) {
3334
const { observeMutation = false, onUpdated, window = defaultWindow } = option
34-
const isXOverflowed = ref(false)
35-
const isYOverflowed = ref(false)
35+
const isXOverflowed = shallowRef(false)
36+
const isYOverflowed = shallowRef(false)
3637

3738
const scope = effectScope()
3839

0 commit comments

Comments
 (0)
0