v-resize-callback-dashan
v1.0.3
Published
vue get dom width height more
Downloads
22
Maintainers
Readme
安装依赖
npm i v-resize-callback-dashan
使用步骤
hooks 使用:
1、引入包
import useResize from "v-resize-callback-dashan"
2、因需要获取dom元素,所以在onMounted中使用hooks
onMounted(()=>{
let dom_test:HTMLTextAreaElement = document.querySelector("#test1") as HTMLTextAreaElement;
useResize(dom_test,(res:DOMRectReadOnly)=>{
console.log(res)
});
})
指令使用
1、在mian.ts 引入包,并绑定
import useResize from "v-resize-callback-dashan"
app.use(useResize)
2、在需要的元素上直接绑定
<textarea v-resize="callbackFunc">自定义指令</textarea>