
js utils
嫩八
这个作者很懒,什么都没留下…
展开
-
Vue图片预览组件
HTML部分<div class="img-view-wrapper" ref="imgWrapper" style="min-height:300px;"> <i class="el-icon-arrow-left imgIcon pre" :class="{ 'disable': index === 0 }" @click="goPrev()"></i> <i class="el-icon-arrow-right原创 2021-11-16 17:12:38 · 2368 阅读 · 0 评论 -
Vue 上传组件
HTML部分<div class="img-file-row"> <div style="flex:1;"> <div><div class="img-handel"> <el-button type="primary" name="onRemove" @click="onRemove()" v-show="isEditing">删除</el-butt原创 2021-11-16 17:08:38 · 1425 阅读 · 0 评论 -
vue 页面导航组件
快速到达指定的面板。当页面内容太多时,可以用此组件效果图html部分<div class="float-nemu-wrapper"> <span class="el-icon-arrow-left" v-if="!show" @mouseover="more" style="width:30px;height:30px;line-height:30px;background:#7a6e6e;border-radius:2px;color:#fff;vertical-align原创 2021-11-15 14:14:44 · 1308 阅读 · 0 评论 -
js 金钱格式化(money)
* value,金额* thou,是否加分号*len 小数数位 Vue.filter('money', function (value, thou, len) { if (value === 'undefined' || value === '' || value == null) { return ''; } if (value < 0) { return '-' + (Vue.tpUtil.原创 2021-11-12 15:28:09 · 1368 阅读 · 0 评论 -
js 正则
PATTERN_AMOUNT: /^(-)?(([1-9][0-9]{0,2}(,\d{3})*)|0)(\.\d{2})?$/, // 金额(千分位且2位小数)PATTERN_WEIGHT: /^(-)?(([1-9][0-9]{0,2}(,\d{3})*)|0)(\.\d{3})?$/, // 重量(千分位且3位小数)PATTERN_POSITIVE_INTEGER: /^[1-9]\d*$/, // 正整数PATTERN_INTEGER: /^-?\d+$/, // 整数PATTERN_DEC原创 2021-11-12 15:11:37 · 257 阅读 · 0 评论 -
js 封装一些时间常用的方法,如计算一年前的今天,比较两日期大小,字符转日期,时间加减,相差月数
相差月数/** * 相差月数 * @param s_time 开始时间 * @param e_time 结束时间 * @param type String 月数加减 1:加;2:减 * @param num int 月数 */ getMonthsApart: function (s_time, e_time, type, num) { var _this =原创 2021-11-12 14:49:34 · 408 阅读 · 0 评论 -
js 常用方法,首字母置为大写,克隆,数组转对象,比较对象
首字母置为大写replaceToUpperCase: function (str) { // 首字母置为大写 var reg = /\b(\w)|\s(\w)/g; // \b判断边界\s判断空格 return str.replace(reg, function (m) { return m.toUpperCase() }); },示例代码:var test = ‘abc’;v原创 2021-11-12 13:51:18 · 392 阅读 · 0 评论 -
vue 导入excle,可以预览
导入exclel,数据转成json,可以预览html部分<div> <div> <el-button :disabled="isReadonly" size="mini" type="primary" @click="onImport()">{{ _btnName }}</el-button> <el-button :disabled="isReadonly" v-show="preview&&i原创 2021-11-12 11:06:55 · 429 阅读 · 0 评论 -
vue 事件修饰符
在事件处理程序中调用 event.preventDefault() 或 event.stopPropagation() 是非常常见的需求。尽管我们可以在 events中轻松实现这点,但更好的方式是:methods 只有纯粹的数据逻辑,而不是去处理 DOM 事件细节。为了解决这个问题,Vue.js 为 v-on(@)提供了事件修饰符。通过由点 (.) 表示的指令后缀来调用修饰符。.stop.prevent.capture.self.once...原创 2021-11-12 09:48:19 · 83 阅读 · 0 评论 -
jquery 穿梭框,可上下左右,全选移动
HTML部分<table align="center" cellpadding="0" cellspacing="0"> <tr> <td> 可选择表项 </td> <td></td> <td> 已选择表项 </td> </tr> <tr> <td> <select mult原创 2021-11-11 17:59:38 · 658 阅读 · 0 评论 -
Vue 自定义指令,保留两位位小数的正数
html 部分<el-input v-enterNumberPoint3> </el-input> js部分Vue.directive('enterNumberPoint3', { inserted: function (el, binding) { var trigger = function (el, type) { var e = document.createEvent(原创 2021-11-10 16:19:01 · 625 阅读 · 0 评论 -
vue 控制多个固定不同类型的数字输入框的输入值相加百分比不超过一百(用于计算费率)
v为输入框的值,type为输入框的 idaddressChange: function (v, type) { var _this = this; v = v.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(原创 2021-11-10 16:07:51 · 2360 阅读 · 0 评论 -
vue.js 封装公用的导出表格方法
//自己内部封装的axios 正常的配置即可import axios from '@/utils/axiosConfig';import { Message } from 'element-ui';/** * * @param {请求路径,请求参数,表格名称,导出的条数} obj */function fileDownLoad(obj) { axios.post( obj.url, obj.param, {responseType: "blob"} ).then(re原创 2020-09-27 17:07:25 · 490 阅读 · 0 评论 -
CSS3 媒体查询,根据屏幕screen大小调节样式显示
CSS3 媒体查询方法的使用常用的几个手机尺寸,便于copy,哈哈哈~????5/SE@media screen and (min-width: 320px) and (max-width: 568px) { }????6/7/8@media screen and (min-width: 375px) and (max-width: 667px) { }????6/7/8 plus@media screen and (min-width: 414px) and (max-width: 73原创 2020-08-28 18:07:33 · 1021 阅读 · 0 评论 -
js常见的数据转换格式处理
整理一些常用的js对数据的处理方法 (不定时更新。。。。)年月日function timestampToTime(time) { var timestamp = (new Date(time)).getTime(); var date = new Date(timestamp );//时间戳为10位需*1000,时间戳为13位的话不需乘1000 var Y = date.getFullYear() + '年'; var M = (date.getMonth()+1 <原创 2020-08-13 11:54:45 · 418 阅读 · 0 评论 -
js常见的表单验证方法
整理一些常用的js校验 (不定时更新。。。。)短信验证码(6位纯数字)isVerificationCodeValid = (verificationCodeValid) => { const code = /^[0-9]{6}$/; return code.test(verificationCodeValid);};登录密码(8-16位数字和字母组合)isPasswordValid = (password) => { const pwd = /^(?![0-9]+$)(原创 2020-08-13 11:07:24 · 306 阅读 · 0 评论 -
js实现姓名,手机号,身份证号,邮箱脱敏处理
手机号脱敏处理需要对手机号保留前三位和最后四位,中间对用*处理如18912341234脱敏处理之后应该变成189****1234。处理方法如下:encryptPhone(str) { if (null != str && str != undefined) { var pat = /(\d{3})\d*(\d{4})/; return str.replace(pat, '$1****$2'); } else { return "";原创 2020-08-13 10:43:49 · 6740 阅读 · 0 评论