随笔分类 - JavaScript
摘要:const arr = [1, 5, 3, 7, 9, 21, 33, 18, 12, 44, 43, 22, 55, 66, 65] const result = arr => { // 存储最小值 let minMax = 0 // 存储最大值 let max = 0 arr.forEach(i
阅读全文
摘要:<div class="content-link"> <span id="link" class="content-link-url ellipsis">{{ userInfo?.user.referralUrl }}</span> <CopyIcon @click="copyUrl" class=
阅读全文
摘要:<div ref="scrollDiv" class="prime-tip"> <div id="scroll_begin" class="item-wrap"> <span v-for="item in promotionInfoVo?.promotionConfigList" :key="ite
阅读全文
摘要:JS 部分为 Vue3 版本写法 <!--描述--> <div class="brand-info-desc"> <input id="btn-input" class="btn-input" v-model="checkbox" type="checkbox"> <div class="text"
阅读全文
摘要:<div id="parent"> <br /> <br /> <br /> <br /> <div class="myElement">Hello!</div> </div> #parent { height: 2000px; } .myElement { position: sticky; to
阅读全文
摘要:if ((i & 1) 0)代替if (i % 2 0)来判断 i 是不是偶数。 原理: 按位与操作符(&) 按位与操作符(&)会对参加运算的两个数据按二进制位进行与运算,即两位同时为 1 时,结果才为1,否则结果为0。运算规则如下: 0 & 0 = 0 0 & 1 = 0 1 & 0 = 0 1
阅读全文
摘要:需求为data数据中,多个数组,数组中的项对应一个盒子,盒子需要有逐个开启的动画。如下例子为 Vue3 const itemArr = Array(15).fill(1) const itemArr2 = Array(10).fill(2) const dataArr = [ { title: 'C
阅读全文
摘要:因为项目中引入了 @vue/composition-api ,因此以下代码为 vue3 + vue2 写法(因为vue-router 3版本不能在 steup 中使用),有好的建议可以提一下~~ import {onActivated, getCurrentInstance } from '@vue
阅读全文
摘要:const filterItem = arr1.filter(item=>!arr2.some(ele=>ele.id item.id))
阅读全文
摘要:在 module.exports 中加入以下代码,@ 代表 src 目录 module.exports = { css: { loaderOptions: { sass: { // 全局sass变量 additionalData: `@import "@/style/scss/common.scss
阅读全文
摘要:watch( () => [tokenDialogState.tokenDialogForm.withdrawFeeMinUsdt, tokenDialogState.tokenDialogForm.coinPriceUsdt], ([withdrawFeeMinUsdt, coinPriceUsd
阅读全文
摘要:直接上代码!!!以下写法为 vue3 <el-select v-model="columnContentList" placeholder="请输入关键词" ref="columnContentSelect" class="column-content-list"> <el-option v-for
阅读全文
摘要:<div ref="tableContainer"> <el-table :height="elTableHeight" > </el-table> </div> data() { return { // table 高度 elTableHeight: null, } } mounted: func
阅读全文
摘要:点击删除按钮报错:reqs[uid].abort is not a function 解决方法: 在http-request函数中写上如下代码就不会再报上述错误。: const prom = new Promise((resolve, reject) => {}) prom.abort = () =
阅读全文
摘要:Vue.util.defineReactive(this, 'current');
阅读全文
摘要:此案例使用的是vue2的@vue/composition-api,大部分代码来自 https://juejin.cn/post/6909252620741787656 此案例根据用户的屏幕宽度自适应为宽度100% vue和pdfjs版本 "vue": "^2.6.12", "pdfjs-dist":
阅读全文
摘要:element-ui上传视频获取视频宽高、视频信息
阅读全文
摘要:在on-change调用的事件中加入以下判断: if (file.status !== 'ready') return
阅读全文
摘要:先安装 yarn add @typescript-eslint/parser -D 然后在.eslintrc配置文件中加入 parserOptions: { parser: '@typescript-eslint/parser', },
阅读全文
摘要:let flag = truewatch(xxx, ()=>{ if(flag && !xxx.value) { flag = false }}, { immediate: true}) 设置immediate为true代表如果在 wacth 里声明了 xxx 之后,就会立即先去执行里面的函数
阅读全文

浙公网安备 33010602011771号