1.2.0 β€’ Published 1 year ago

resize-observer-vue v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

resize-observer-vue

NPM version NPM downloads

πŸ„β€β™€οΈ docs
Or if you want to use react πŸ€Έβ€β™‚οΈ for react

ζ•ˆζžœ

The width of the case box is 100% by default. You need to manually switch the viewport width

whatοΌŸπŸ™Š

Whether the size and location of the listening component have changed, Only support vue3

How to use it? πŸ™ˆ

pnpm add resize-observer-vue

1. Similar to the use of react high-order components

import

import { createApp } from 'vue'
import ResizeObserver from 'resize-observer-vue'
import App from './example/App.vue'

const app = createApp(App)

app.use(ResizeObserver).mount('#app')

Or introduced as a component

import { ResizeObserver } from 'resize-observer-vue'

use

<ResizeObserver :on-resize="callback" :disabled="false">
    <TargetComponent/>
<ResizeObserver/>

2. The same supports vue instructions

registration Directive

import { directive } from 'resize-observer-vue'
const app = createApp({})

app.directive('resize', directive)

use

<TargetComponent v-resize:[disabled]="callback" />

API

PropertyTypeDefaultDescription
disabledbooleanfalseWhether to disable observation
onResize({ width, height }) => void-Trigger when child node resized
1.2.0

1 year ago

1.2.0-beta.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.1

1 year ago