09 2021 档案

vue监听 浏览器后退 前进按钮
摘要:Vue监听浏览器的后退与前进按钮 // 检查浏览器是否支持history API if (window.history && window.history.pushState) { // 如果支持,给window添加popstate监听事件,用于监听后退按钮的点击 window.addEventLi 阅读全文

posted @ 2021-09-27 19:31 完美前端 阅读(2494) 评论(0) 推荐(0)

安装vue3
摘要:1、安装Vue CLI脚手架: - 首先,新建一个文件夹,在文件夹内打开命令行(cmd)。 - 输入以下命令来全局安装Vue CLI脚手架: ``` cnpm install -g @vue/cli ``` - 注:这里使用的是cnpm命令,确保您已经安装了cnpm。如果您使用npm,只需将cnpm 阅读全文

posted @ 2021-09-17 18:36 完美前端 阅读(697) 评论(0) 推荐(0)

window.open 跳转页面打开新标签 模拟单击
摘要:打开新窗口:无异步 // 直接打开新窗口并导航到指定的URL let windowObjectReference = window.open(); windowObjectReference.location.href = 'https://www.baidu.com'; 打开新窗口:有异步 // 阅读全文

posted @ 2021-09-16 16:04 完美前端 阅读(886) 评论(0) 推荐(0)

vue 刷新页面的几种方法
摘要:1、最直接整个页面重新刷新: // 使用location.reload()方法刷新页面 location.reload() // 使用Vue路由的$router.go()方法刷新当前页面 this.$router.go(0) 这两种都可以刷新当前页面的,缺点就是相当于按ctrl+F5 强制刷新那种, 阅读全文

posted @ 2021-09-13 22:55 完美前端 阅读(2493) 评论(0) 推荐(0)

js base64加密解密 btoa和atob atob解析
摘要:使用btoa进行Base64编码 // btoa只能编码ASCII字符串,如果有非ASCII字符,可能会导致错误。 // 定义一个json对象 let json = { channel: '100000', i_code: '3', invite_code: '' }; // 使用btoa将json 阅读全文

posted @ 2021-09-13 18:35 完美前端 阅读(2649) 评论(0) 推荐(0)

js获url后的参数
摘要:获取URL中的查询参数 // 定义函数获取URL查询参数并返回一个对象 function GetRequest() { let url = location.href; // 获取完整的URL let theRequest = {}; if (url.indexOf('?') != -1) { le 阅读全文

posted @ 2021-09-13 18:20 完美前端 阅读(1689) 评论(0) 推荐(0)

vue 巧妙刷新 provide 和 inject
摘要:// 导入vue中的相关方法 import { provide, reactive, nextTick } from "vue"; // 定义全局数据 let globeData = reactive({ isRouterAlive: true }) // 通过条件渲染来控制router-view的 阅读全文

posted @ 2021-09-11 22:19 完美前端 阅读(483) 评论(0) 推荐(0)

vue3 注册全局的toast组件
摘要:完整的代码, 可以复制引用 toast组件 <template> <Transition name="down"> <div class="xtx-message" :style="style[type]" v-show="visible"> <!-- 上面绑定的是样式 --> <!-- 不同提示图 阅读全文

posted @ 2021-09-04 22:44 完美前端 阅读(2575) 评论(1) 推荐(0)

导航