VueUse官网地址https://vueuse.org/

这里就列举常用工具详情请去官网 查看所有API

浏览器

useFullscreen全屏展示

//isFullscreen 当前是否是全屏
//toggle  是函数直接调用即可
const { isFullscreen, toggle } = useFullscreen();

useClipboard粘贴功能

//text 粘贴的内容
//copy 是粘贴函数
const { text, copy, isSupported }
= useClipboard({ copiedDuring: 1500 });

useDark开启暗黑模式工具

这个需要自定义样式类通过 toggleDark函数控制

const isDark = useDark({selector: "body",//class渲染的标签valueDark: "dark",//暗黑class名字valueLight: "light"//高亮class名字
});
const toggleDark = useToggle(isDark);

useTitle设置标题内容

const title = useTitle()
console.log(title.value) // print current title
title.value = 'Hello' // change current title

useUrlSearchParams设置Url内容

    const params = useUrlSearchParams('history')params.foo = 'bar';params.vueuse = 'awesome';

当时我学习的案例看不懂联系我

<template><div><h1>VueUse工具插件</h1><div><input type="text" /></div><h5 @click="toggle">useFullscreen全屏展示</h5><h5>useActiveElement()当前点击的元素</h5><h5>useBreakpoints选择当前窗口范围</h5><h5>useBrowserLocation浏览器URL信息</h5><note>useClipboard 粘贴功能</note><p>当前粘贴内容:<code>{{ text || 'none' }}</code></p><input v-model="input" type="text" /><button @click="copy(input)">Copy</button><div v-if="!isSupported">你的浏览器不支持当前api</div><div><h5>useCssVar控制css变量</h5><div ref="el" style="color: var(--color)">颜色值, {{ color }}</div><button @click="switchColor">改变颜色</button></div><div><h3>开启useDark 黑暗模式</h3><button @click="toggleDark">开启暗黑模式</button></div><div><h4>useEventListener 页面卸载自动卸载监听</h4></div><div><h4>useFavicon网站图标更换 一般跟 usePreferredDark当前页面是否是暗黑主题还有useDark 一起使用</h4></div><div><h4>useFetch一款http请求插件,感觉axios的功能都有反正没什么区别感觉可能比axios方便</h4></div><div><h4>useMediaControls媒体控制器提供了自定义媒体组件的基本元素</h4></div><div><h4>useMediaQuery媒体查询跟原生html类似</h4></div><div><h4>usePermission</h4><h5>未来提高用户体验截止到2021年5月当前api还在实验阶段无法使用,<ahref="https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API">MDN Web api介绍</a></h5></div><div><h4>usePreferredColorScheme</h4><h5>查询当前配色方案 跟,useDark相关函数配合使用</h5></div><div><h4>usePreferredDark</h4><h5>当前页面是否是暗黑主题</h5></div><div><h4>useShare </h4><h5 @click="startShare">点击分享谷歌支持其他平台估计不支持</h5></div><div><h4>useTitle </h4><h5 >设置浏览器标题</h5></div><div><h4> useUrlSearchParams </h4><h5 >设置浏览器Url参数</h5><ul><li v-for='key in Object.keys(params)' :key="key">{{ key }}={{ params[key] }}</li></ul></div></div>
</template>
<script setup>
import { reactive, watch, ref } from "vue";
import {useFullscreen,useActiveElement,useBreakpoints,useBrowserLocation,useClipboard,usePermission,useCssVar,useDark,useToggle,useScriptTag ,useShare,useTitle,useUrlSearchParams
} from "@vueuse/core";
const title = useTitle()
console.log(title.value) // print current title
title.value = 'Hello' // change current title
const { share } = useShare();
function startShare() {share({title: 'Hello',text: 'Hello my friend!',url: location.href,})
};const params = useUrlSearchParams('history')params.foo = 'bar';params.vueuse = 'awesome';
const microphoneAccess = usePermission("microphone");
const breakpoints = useBreakpoints({tablet: 640,laptop: 1024,desktop: 1280
});
const isDark = useDark({selector: "body",valueDark: "dark",valueLight: "light"
});const toggleDark = useToggle(isDark);
let input = "";
let el = null;
const color = useCssVar("--color", el);
const switchColor = (color) => {color.value =color
};
const laptop = breakpoints.between("tablet", "desktop");
const location = useBrowserLocation();
const { isFullscreen, toggle } = useFullscreen();
const activeElement = useActiveElement(); //当前点击的元素
const { text, copy, isSupported } = useClipboard({ copiedDuring: 1500 });
watch(isDark, el => {console.log("是否是含黑模式", el);
});watch(activeElement, el => {console.log("focus changed to", el);
});
</script>

VueUse中文文档Vue官方工具库相关推荐

  1. VueUse中文文档/Vue官方工具库

    VueUse官网地址https://vueuse.org/ 这里就列举常用工具详情请去官网 查看所有API 浏览器 useFullscreen全屏展示 //isFullscreen 当前是否是全屏 / ...

  2. AutoIt 在线中文文档、开发工具 (GUI 图形开发工具)

    AutoIt 在线中文文档.开发工具 (GUI 图形开发工具) 一.在线中文文档 1.1 官方文档翻译版 1.2 用户自定义函数 1.3 脚本之家版 二.开发工具 一.在线中文文档 1.1 官方文档翻 ...

  3. python pptx库中文文档_基于python-pptx库中文文档及使用详解

    个人使用样例及部分翻译自官方文档,并详细介绍chart的使用 一:基础应用 1.创建pptx文档类并插入一页幻灯片 from pptx import Presentation prs = Presen ...

  4. Backtrader官方中文文档:集成TA-Lib指标库参考

    本文档参考backtrader官方文档,是官方文档的完整中文翻译,可作为backtrader中文教程.backtrader中文参考手册.backtrader中文开发手册.backtrader入门资料使 ...

  5. VueUse 中文文档:Components 组件

    在v5.0中,我们引入了一个新的包@vueuse/components,它提供了组合式函数的无渲染组件版本. Install $ npm i @vueuse/core@vueuse/component ...

  6. Chrome 开发者工具官方中文文档

    传送门 Chrome开发者工具官方中文文档 Chrome开发者工具详解 前端学习front-end-study系列 Elements面板(https://zhuanlan.zhihu.com/p/24 ...

  7. python中文昵称-官方出品 Python 中文文档!拜托,别再说看不懂了

    点击" 开发者技术前线 ",选择"星标�" 在看|星标|留言, 真爱 回复"666",获取一份技术人专属大礼包 作者:机器之心 参与:思源 ...

  8. Python官方中文文档来了

    你不一定要点蓝字关注我的 机器之心报道 参与:思源 Python 作为世界上最好用的语言,官方支持的文档一直没有中文.小伙伴们已经习惯了原汁原味的英文文档,但如果有官方中文文档,那么查阅或理解速度都会 ...

  9. Python用不好?终于有官方中文文档啦

    点击上方"码农突围",马上关注 这里是码农充电第一站,回复"666",获取一份专属大礼包 真爱,请设置"星标"或点个"在看&quo ...

  10. Python 深度学习库 Keras 发布官方中文文档,这里有你需要了解的一切

    今年1月,Keras作者.谷歌AI研究员François Chollet在推特上发出召唤:讲中文的Keras用户们,是否有人愿意帮忙一起搞个Keras文档的中文版? 一个多月后,官方中文文档来了. K ...

最新文章

  1. 创建一个触发器新增字段的时候设置某个字段的值
  2. 帝国CMS的phomenewspic/ecmsinfo标签详解
  3. 数据中台建设是噱头还是黑科技?
  4. 第一章:linux管理文件和目录
  5. JavaScript中的回调地狱及解决方法
  6. 7-9 包装机 (25 分)
  7. 7-3 服务器统一出错处理
  8. 有一份好看的简历,面试都要加分,推荐好看的简历来这里下载
  9. 视频编解码学习之四:视频处理及编码标准
  10. 第3章 从零开始的计算机系统
  11. python 图片二值化后 判断图片是白底黑字,还是黑底白字
  12. 微信小程序tarBar使用
  13. 【Android】四大组件介绍 *广播机制*
  14. 光线追踪(RayTracing)算法
  15. 一天发十万封邮件方法_网上投递简历,如何避免求职邮件成为垃圾?
  16. 利达主机如何注册设备_利达主机操作说明
  17. Vue项目History模式404问题解决
  18. dedecms织梦系统安装步骤
  19. Baxter实战——Ubuntu 14.4+ros indigo 安装Baxter Simulator与 Moveit
  20. 图像分类实战:mobilenetv2从训练到TensorRT部署(pytorch)

热门文章

  1. MySQL教程:MySQL数据库学习宝典(从入门到精通)
  2. 热炉法则:规章制度面前人人平等 | 每天成就更大成功
  3. python mql4_使用MQL5将OHLC值从Python API集成到MT5
  4. Matlab:拉盖尔-高斯光束单缝衍射
  5. java单例调用_java单例模式
  6. 弯曲时空量子场论的历史与现状 (下)
  7. 使用Kali Linux Metasploit 复现 word宏
  8. Python url的编码转换
  9. 什么是虚短、虚断、虚地
  10. 【战“疫”案例展】上海临港方舱医院——7天打造“数字方舱”,搭建智能化管理系统平台...