Options
All
  • Public
  • Public/Protected
  • All
Menu

Module vx-hooks/useMutationObserver

响应元素属性变化

Index

Variables

Const defaultMutationObserverInit

defaultMutationObserverInit: { attributes: boolean } = ...

useMutationObserver 默认属性配置

Type declaration

  • attributes: boolean

Functions

useMutationObserver

  • 响应元素属性变化

    example
    {
      template : `
         <div id='box' :style='style' ref='element' @click='change'>
         </div>
       `,
       props: ['handler'],
       setup(props: any){
         const style = ref({
           width: '100px',
           height: '100px'
         })
    
         const change = () =>{
           style.value = {
             width: '200px',
             height: '200px'
           }
         }
    
         const { element } = useMutationObserver({
           handler: props.handler
         })
    
         return{
           style,
           change,
           element, 
         }
       }
    }
    
    

    Parameters

    Returns useMutationObserverAPI

Generated using TypeDoc