lljtop-v-resize
v1.0.0
Published
vue-resize-package
Downloads
1
Readme
lljtop-v-resize
vue-resize-package
Install
npm install lljtop-v-resize --save
Usage
hook写法
template
<div id="myElement"></div>
script
import useResize from "lljtop-v-resize";
import { onMounted } from "vue";
onMounted(() => {
useResize(document.querySelector("#myElement") as HTMLElement, (e) => {
// 操作e
console.log(e);
});
});
自定义指令写法
main.ts
import useResize from "lljtop-v-resize";
createApp(App).use(useResize).mount("#app");
template
<div v-resize="handleResize" id="myElement"></div>
script
const handleResize = (e: Event) => {
// 操作e
console.log(e);
};