resize-observer-vue

Resize observer for Vue
929 5
Install
npm install resize-observer-vue
Latest Version:1.2.0
Vue:3
License:MIT
Last Updated:Aug 23, 2023
Links: GitHub  ·  npm
Maintainer: gongking

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

Property Type Default Description
disabled boolean false Whether to disable observation
onResize ({ width, height }) => void - Trigger when child node resized

Related Packages

@vue-toys/resize-observer

Resize observer directive for vue 3.0

4,751 2
vue-json-tree-view

a JSON Tree View Component in Vue.js

380,792 473
@v-c/picker

picker ui component for vue

57,185 32
vue-frame-crm

vue components for crm system

15,005
kokk

A beautiful way to create a documentation from markdown, and insert a vue compon...

10,142 49

Version History

Version Released Vue License
1.2.0 >=3.0.0 MIT
1.1.1 >=3.0.0 MIT
1.1.0 >=3.0.0 MIT
1.0.11 >=3.0.0 MIT
1.0.10 >=3.0.0 MIT
Pre-releases (1)
Version Released Vue License
1.2.0-beta.0 >=3.0.0 MIT