![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JavaScript
进阶de程序猿
这个作者很懒,什么都没留下…
展开
-
vue数组中交换位置,数组重新排序
this.tableData 数组index 点击行的索引top(index, row) { // 点击上箭头,获取当前行下标 this.tableData.splice( index, 1, ...this.tableData.splice(index - 1, 1, this.tableData[index]) ); // console.log(t.原创 2022-03-15 14:38:40 · 1213 阅读 · 0 评论 -
vue 中的打印 局部打印
下载print.js print下载在项目main.js导入main.jsimport Print from '../config/print'Vue.use(Print).vue局部打印了快递单号,里面有base 64的图片<div ref="printarea" v-html="parinlist"> <div v-html="parinlist">{{parinlist}}</div> </div>原创 2022-02-16 16:56:38 · 780 阅读 · 0 评论 -
根据输入汉字生成首字符拼写
// 公共方法 createPinyinUpperCode(str) { var pinyinData = pinyin(str, { style: pinyin.STYLE_FIRST_LETTER, // 设置拼音风格 heteronym: false }) return pinyinData.join("").toUpperCase(); },watch: { "sendDat原创 2021-12-05 17:03:22 · 107 阅读 · 0 评论 -
vue js获取url地址栏的参数
/有疑问请在评论区留言。原创 2021-11-04 10:55:30 · 863 阅读 · 0 评论 -
vue路由传参
跳转前this.$router.push({ name: "activDetails", query: { activityId: data.activityId, }, });在这打印 this.$route能看到参数然后接收this.$route.query.activityId原创 2021-11-02 15:39:09 · 68 阅读 · 0 评论 -
js百度地图获取当前位置,并计算设定经纬度距离
获取当前位置百度地图JSAPI WebGL v1.0类参考官网api<script type="text/javascript" src="http://api.map.baidu.com/getscript?v=2.0&ak=自己申请的ak"></script><script type="text/javascript"> var geolocation = new BMap.Geolocation(); geolocation.getCurre原创 2021-10-18 15:18:37 · 2747 阅读 · 0 评论 -
js数组中某个值的累加
sendDataInfo: { pisOrderDetail: [{ bgmName: "", bgmId: "", money: "", price: "", psmoney: "", psprice: "", psodPacknum: "", }],},定义和用法reduce() 方法接收一个函数作为累加器,数组中的每个值(从左到右)开始缩减,最终计算为一个值。reduc原创 2021-09-01 10:01:13 · 3211 阅读 · 6 评论 -
数组去重合并
<script type="text/javascript">//公共函数 es6 function combine(){ let arr = [].concat.apply([], arguments); //没有去重复的新数组 return Array.from(new Set(arr)); } var m = [1, 2, 2,5,4,7,8,1,1,1,4], n = [2,3,3]; console.log(combine(m,n));原创 2020-09-23 15:03:55 · 72 阅读 · 0 评论 -
前端浏览器判断
function getBrowserInfo() { var ua = navigator.userAgent.toLocaleLowerCase(); var browserType = null; if (ua.match(/msie/) != null || ua.match(/trident/) != null) { browserType = "IE"; browserVersion = ua.match(/msie ([\d.]+)/) != null ? ua.m原创 2020-09-16 14:21:56 · 386 阅读 · 0 评论 -
vue延迟3秒跳转
方法一setTimeout(()=>{ //需要延迟的代码 :3秒后延迟跳转到首页,可以加提示什么的 this.$router.push({ name:"index" }); //延迟时间:3秒 },3000)原创 2020-06-09 11:17:23 · 9588 阅读 · 0 评论 -
js删除两个数组相同的对象,数组去重
multipleSelection datatable 是数组for(let i in this.multipleSelection){ for (let k in this.datatable) { if (this.multipleSelection[i].content == this.datatable[k].content) { this.datatable.splice(k原创 2020-05-28 13:43:57 · 934 阅读 · 2 评论 -
js分页效果
<!doctype html><html><head><meta charset="utf-8"><title>js分页效果</title><style>* { margin:0; padding:0;}img { border:0;}ol,ul,li { list-style:none;}.box { width:100%; height:500px.原创 2020-05-10 13:18:18 · 307 阅读 · 0 评论 -
vue element 动态获取后台枚举接口 根据code返回对应name值
element 表格获取HTML部分 <el-table-column prop="state" label="团队状态" align="center" :formatter="statetype"> </el-table-column>js部分teamStates(){...原创 2020-04-29 18:02:44 · 1697 阅读 · 0 评论 -
前端正则表达式
手机号/^1[345678]\d{9}$/密码 字母和数字组合,但不为纯数字/^(?!\d+$)[\da-zA-Z]+$///最少6位,包括至少1个大写字母,1个小写字母,1个数字,1个特殊字符/^.*(?=.{6,})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*? ]).*$/身份证 15到18位数字,或者17位数字加 x/(...原创 2020-04-16 11:46:58 · 426 阅读 · 0 评论 -
判断滚轮距离顶部的位置
这里写自定义目录标题vue 写一个方法然后在生命周期里调用vue 写一个方法然后在生命周期里调用mounted() { this.top(); }, methods: { top() { // 页面被卷去的高度 scrollT 滚动距离 window.onscroll = function() { let scrol...原创 2020-01-17 17:42:45 · 583 阅读 · 0 评论