tankhooks
tankhooks
针对 Vue3 的实用Hooks集合
安装
$ npm i tankhooks --save
$ yarn add tankhooks
文档
使用文档
使用简介
获取鼠标点击的位置
import { useMousePosition } from "tankhooks";
const { clickY, clickX } = useMousePosition();
获取滚动的距离
import { useScrollPosition } from "tankhooks";
const { scrollY } = useScrollPosition();
deepCopy对象
import { useDeepCopy } from "tankhooks";
const newData = useDeepCopy(data);
线上进程暂停程序
import { useSleep } from "tankhooks";
useSleep(2000)
点击按钮实现自动复制到剪切板,必须用户触发才可以,不可以直接调用js触发
import { useCopy } from "tankhooks";
const copy = async (value) => {
const result = await useCopy(value);
if(result==="SUCCESS") {
console.log("复制到剪切板成功")
} else if(result==="ERROR"){
console.log("复制到剪切板失败")
}
};
Related Packages
vue-timer-hook
Vue 3 composition API hooks for countdown timers, stopwatches, and live clock st...
189,124
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.1.11 | ^3.2.37 | ISC | |
| 1.1.10 | ^3.2.37 | ISC | |
| 1.1.9 | ^3.2.37 | ISC | |
| 1.1.8 | ^3.2.37 | ISC | |
| 1.1.7 | ^3.2.37 | ISC | |
| 1.1.6 | ^3.2.37 | ISC | |
| 1.1.5 | ^3.2.37 | ISC | |
| 1.1.4 | ^3.2.37 | ISC | |
| 1.1.3 | ^3.2.37 | ISC | |
| 1.1.2 | ^3.2.37 | ISC | |
| 1.1.1 | ^3.2.37 | ISC | |
| 1.0.9 | ^3.2.37 | MIT | |
| 1.0.8 | ^3.2.37 | MIT | |
| 1.0.7 | ^3.2.37 | MIT | |
| 1.0.6 | ^3.2.37 | MIT | |
| 1.0.5 | ^3.2.37 | MIT | |
| 1.0.4 | ^3.2.37 | MIT | |
| 1.0.3 | ^3.2.37 | MIT | |
| 1.0.2 | ^3.2.37 | MIT | |
| 1.0.1 | ^3.2.37 | MIT | |
| 1.0.0 | ^3.2.37 | MIT |