![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JS
lemon_tree1002
这个作者很懒,什么都没留下…
展开
-
JS 判断list中是否存在某个元素
例如:$(['temporaryCooperation', 'effective', 'restrictionCompletion', 'rejected', 'submitted']).contains("submitted")==> true$([0,1,2,3,4,5]).contains(0)==> true$([0,1,2,3,4,5]).contains(10)==> falsea=[1,2,3,3,4,5,8]$(a).contains(原创 2022-03-23 16:44:20 · 5746 阅读 · 0 评论 -
JS 获取object中键值对个数
Object.getOwnPropertyNames({"name":"dasd","age":18}).length输出 2Object.getOwnPropertyNames({"name":"dasd","age":18,"sex": "M"}).length输出 3原创 2022-03-18 10:06:33 · 937 阅读 · 0 评论 -
JS 去掉string前后空格
去左空格;str.replace(/(^\s*)/g, "")去右空格;str.replace(/(\s*$)/g, "")去左右空格;str.replace(/(^\s*)|(\s*$)/g, "")原创 2022-03-18 10:04:13 · 1625 阅读 · 0 评论 -
js 字符串转json
1.evel2. JSON.parse(text)注意:这text必须被 '' 包裹,不可以是 "",text中的内容必须是标准有效的JSON错误示例:原创 2022-01-12 14:50:21 · 355 阅读 · 0 评论 -
JS-002-slice数组处理
js 处理数组方法slice(): 从已有的数组中返回选定的元素原创 2021-12-21 16:37:07 · 330 阅读 · 0 评论 -
VUE-004-动态给style赋值
<el-button :style="{width: buttonWidth}"></el-button>比如:当判断当前界面是英文模式下,width是90px,中文模式下,width是80px;<script> computed: { buttonWidth: function() { return getLang() == 'zh_CN' ? 80 + 'px' : 90 + 'px'; }.原创 2021-12-21 15:26:19 · 2295 阅读 · 0 评论 -
VUE-003-页面跳转
方法一(跳转到其他网站,target="_blank"):<a :href="link" target="_blank"> <el-button type="text" size="small">跳转</el-button></a><script> expott default { data() { return { link: "https://原创 2021-12-21 15:02:57 · 296 阅读 · 0 评论 -
JS-001-前端开发中遇到filesize大小转化的问题
if (field == 'fileSize') { if (value < 1024) { return value.toFixed(2) + 'B' } else if (value >= 1024 && value < Math.pow(1024, 2)) { return parseFloat(value / 1024).toFixed(2) + 'KB' .原创 2021-12-21 11:16:11 · 709 阅读 · 0 评论