js
qq_45505241
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
字符串去除一些关键字
字符串去除特定关键字。原创 2023-02-28 11:09:52 · 170 阅读 · 0 评论 -
前端本地下载
前端下载原创 2022-12-12 10:57:10 · 186 阅读 · 0 评论 -
打开新标签改标题
标签改标题原创 2022-07-05 10:25:33 · 217 阅读 · 0 评论 -
编码和解码
编码和解码原创 2022-06-29 14:24:54 · 122 阅读 · 0 评论 -
识别换行符
<el-col :span="24" class="flex"> <label class="c65" style="flex: 0 0 100px;"> 课题注意事项:</label> <em class="c45 flex1" style="white-space: pre-wrap;">{{ platformType.topicPointsForAttention }}</em>原创 2022-04-12 10:00:05 · 421 阅读 · 0 评论 -
select2远程搜索编辑赋值的问题
$('#remoteSelect').select2({ placeholder: "请输入终端用户", width:"100%", dropdownParent:dialog, ajax: { url: common.url_agent_web + '/stoc原创 2022-03-07 17:49:59 · 414 阅读 · 0 评论 -
table上下移动
上移this.drugs[index] = this.drugs.splice(index - 1, 1, this.drugs[index])[0]下移this.drugs[index] = this.drugs.splice(index + 1, 1, this.drugs[index])[0]原创 2021-11-30 15:38:00 · 176 阅读 · 0 评论 -
换行(包括数字,单词)
.text { word-break: break-all; white-space: pre-wrap; }原创 2021-07-14 16:04:23 · 133 阅读 · 0 评论 -
js数组终止循环的方法
var arr = [1,2,3,4,5,6,7]; try { arr.forEach((item,index) => { console.log(item); if(item == 3){ throw new Error('break'); } }); } catch (e) { // console.log(e); } finally { }原创 2021-05-14 18:12:15 · 2520 阅读 · 0 评论 -
前端假分页
this.list.filter((v ,i) => (i < (this.page.pageNo) * this.page.pageSize) && (i >= (this.page.pageNo-1) * this.page.pageSize));原创 2021-04-29 16:51:12 · 315 阅读 · 0 评论 -
表格渲染性能
vue 表格渲染性能问题https://www.jb51.net/article/158157.htm原创 2021-03-11 16:35:37 · 119 阅读 · 0 评论 -
reduce的用法
## 1const test = arr => ( arr.reduce((prev, next) => [ ...prev, ...prev.map(item => [ next, ...item ]) ], [[]]))console.log(test([1,2,3]));// 打印结果[ [], [ 1 ], [ 2 ], [ 2, .原创 2021-02-22 16:14:03 · 197 阅读 · 0 评论 -
解决火狐的moment转换日期错误
startDate: '2020-1-1'new Date(Date.parse(startDate.replace(/-/g, "/")));输出:'2020/1/1'原创 2021-01-30 18:06:14 · 514 阅读 · 0 评论 -
根据拼音或者首字母查名字,汉字也可以
1.后台返回的数组对象中有sname:"赵青",snameCode: "ZHAOQING";data() { return { regrex: /.*.*/i, // 初始值 }}2.通过element ui的select的:filter-method="filterMethod"方法;filterMethod(val){ //自定义搜索方法 this.regrex = new RegExp(`.*${(val || "").split("").join原创 2021-01-30 18:00:17 · 1190 阅读 · 0 评论 -
给时间排序
arr.sort((a, b) => (a > b ? 1 : -1))原创 2021-01-14 15:03:14 · 135 阅读 · 0 评论 -
正则校验手机号和邮箱
// 同时验证手机和固定电话const mobile = /^((0\d{2,3}-?\d{7,8})|(1[3-9]\d{9}))$/// 验证邮箱const emil = /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/原创 2020-12-29 18:45:39 · 475 阅读 · 0 评论 -
获取高度的问题
原创 2020-11-26 15:06:18 · 140 阅读 · 0 评论 -
清除node_modules
快速清除node_modules的指令,同级下打开命令行执行 rimraf ./node_modules原创 2020-09-16 17:52:28 · 941 阅读 · 0 评论 -
后台返回\n的字符串,前端让其自动换行
res:'qweeqeqwqwq\nasdaawaas\n124124'<div style="white-space: pre-line;">{{res}}</div>//样式不能少,这样就可以自动换行了原创 2020-07-14 15:35:51 · 2894 阅读 · 0 评论 -
数组对象中去除所有的key都没有值的对象
function isEmpty(obj) {let empty = true;for (let key in obj) {if (obj[key]) {empty = false;break;}}return empty}function filter(array) {return array.filter( item => !isEmpty(item))}let newArr = filter(array);console.log(newArr)原创 2020-07-02 01:07:18 · 750 阅读 · 0 评论 -
给后台返回的数据增加一个自定义属性和处理数据
getUserList().then(res => { let data = res.data.map(res => { let temp = res temp.ischeck = false return temp }) }原创 2020-04-11 08:47:05 · 1281 阅读 · 0 评论 -
窗口变化重新加载Echarts(resize())
写在mounted里面window.addEventListener('resize', () => { const myChart = echarts.init(document.getElementById('chart-left')) const myChart1 = echarts.init(document.getElementById('chart-bt...原创 2020-04-08 15:11:18 · 2304 阅读 · 1 评论 -
俄罗斯方块js源码
<!doctype html><html><head><meta charset="utf-8"><title>JS版本-俄罗斯方块</title><style>*{ margin:0; padding:0;}li{ list-style:none;}#container{ width:430px;...原创 2019-11-15 22:40:28 · 166 阅读 · 0 评论 -
原型链
function Person(){}var person=new Person()console.log(person.proto=Person.prototype) //trueconsole.log(Person.prototype.constructor=Person)//trueEs5的方法获取对象的类型:console.log(Object.getPrototypeOf(pe...原创 2019-11-15 22:17:41 · 99 阅读 · 0 评论 -
event.offsetX ,事件
原创 2019-11-07 20:30:41 · 2537 阅读 · 0 评论 -
闭包
/* function foo(){var a = 10;function bar(){ //这个函数叫做闭包console.log(a);}} *//* function foo(){ var a = 10; return function(){ console.log(a); };}//return出来的是一个函数表达式,可以在后面...原创 2019-09-02 15:22:48 · 233 阅读 · 0 评论
分享