随笔分类 - JS
摘要:html 头像UI <button class="user-avatar flex-center" open-type="chooseAvatar" @chooseavatar="onChooseAvatar"> <image class="img" :src="showAvatat()" mode
阅读全文
摘要:import SockClient from 'sockjs-client' const Stomp = require('@stomp/stompjs') // 方法 createStompClient() { const that = this const ws = new SockClient
阅读全文
摘要:getQueryParams() { const paramsString = new URLSearchParams(window.location.search).toString(); // 将查询字符串转换为字符串 const paramsArray = paramsString.split
阅读全文
摘要:function formatSeconds(time) { const h = parseInt(time / 3600) const minute = parseInt(time / 60 % 60) const second = Math.ceil(time % 60) const hours
阅读全文
摘要:传送门:https://blog.csdn.net/FTEzreal/article/details/115245562 传送门:https://juejin.cn/post/6844904016976035854
阅读全文
摘要://判断系统类型 function OSnow() { const agent = navigator.userAgent.toLowerCase() const isMac = /macintosh|mac os x/i.test(navigator.userAgent) if (agent.in
阅读全文
摘要:<el-table-column prop="cvRobotName" label="机器人" align="center" v-if="mode !== 2"> <template slot-scope="item"> <el-select v-model="tableData[scope.$in
阅读全文
摘要:判断是否有滚动条 // dom 元素 const dom = this.$refs.uploadTableRef?.bodyWrapper // 滚动到底部 if (dom?.scrollTop + dom?.clientHeight dom?.scrollHeight) { console.log
阅读全文
摘要:效果图 搜索前: 搜索后: 使用 安装插件 pinyin-match: npm install pinyin-match --save 下拉: <el-select v-model="form.robot" placeholder="机器人" @change="robotSearch" filter
阅读全文
摘要:第一种,JS 1、判断dom this.$refs.squareRef.addEventListener('wheel', this.addScrolbarFn, false) addScrolbarFn(event) { event.stopPropagation() const dom = th
阅读全文
摘要:一、js 判断 根据浏览器ua判断当前是否为移动设备: middleware中间件执行流程顺序: 1、nuxt.config.js 2、匹配布局 3、匹配页面 项目根目录下新建 middleware 文件夹,新建 midd.js 文件 export default function ({ isSer
阅读全文
摘要:// 替换 html 特殊字符 export function replaceHtmlSymbol(html) { if (html == null) { return '' } return html.replace(/</gm, '<') .replace(/>/gm, '>') .
阅读全文
摘要:初始化 Map,在创建的同时初始化实例,可以给 Map 构造函数传入一个可迭代对象,需要包含键/值对数组。 // 使用嵌套数组初始化映射 const m1 = new Map([ ["key1", "val1"], ["key2", "val2"], ["key3", "val3"] ]); ale
阅读全文
摘要:clientX 鼠标相对于浏览器(这里说的是浏览器的有效区域)左上角x轴的坐标; 不随滚动条滚动而改变; clientY 鼠标相对于浏览器(这里说的是浏览器的有效区域)左上角y轴的坐标; 不随滚动条滚动而改变; pageX 鼠标相对于浏览器(这里说的是浏览器的有效区域)左上角x轴的坐标; 随滚动条滚
阅读全文
摘要:date-fns dayjs 传送门:https://mp.weixin.qq.com/s/EPoysX0ytb1WzKQHgnACTg
阅读全文
摘要:样式 <el-upload class="upload-demo" action="/api/file/upload" :on-remove="handleRemove" multiple ref="uplpadFile" :limit="1" :on-exceed="handleExceed" :
阅读全文
摘要:// 大小计算 calculateSize(size) { if (size > 1024) { return Math.floor((size / 1024) * 100) / 100 + 'MB' } else if (size <= 0) { return '0kb' } else { ret
阅读全文
摘要:获取后台数据接口,当数据无的时候,可以移除滚动监听 mounted() { // 监听滚动 window.addEventListener("scroll", this.getScroll, true); }, // 瀑布流滚动到底部 getScroll() { // vue 获取元素 const
阅读全文
摘要:Object.defineProperty 实现 相当于全局劫持 a ,只要发现 a ,就执行方法(三目运算符); Object.defineProperty(window, 'a', { get: function () { //this指向window.a this.value ? this.v
阅读全文