![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js
RubyLinT
这个作者很懒,什么都没留下…
展开
-
前端请求后端接口报错:400 Bad Request
后来发现是cookie太长了,存在cookie里的内容每次请求都会发送给后端。于是把之前存在cookie里的数据存其他地方了。原创 2022-08-23 14:40:54 · 674 阅读 · 0 评论 -
vue 使用jszip将多个文件压缩下载压缩包
vue 使用jszip将多个文件压缩下载压缩包原创 2022-05-24 09:23:36 · 1460 阅读 · 0 评论 -
高德地图根据地址返回经纬度
调用api:https://restapi.amap.com/v3/assistant/inputtips?output=json&keywords=地址&key=申请的应用key若报错:USERKEY_PLAT_NOMATCH则是申请的应用与实际使用的应用不一致,需申请对应的应用(Web服务跟Web端是有区别的)...原创 2022-01-20 13:43:42 · 881 阅读 · 0 评论 -
高德地图使用AMap.DrivingPolicy.LEAST_DISTANCE报错
报错:Cannot read properties of undefined (reading 'LEAST_DISTANCE')原因:在引入js的时候加上&plugin=AMap.Driving,即:https://webapi.amap.com/maps?v=${this.v}&key=${this.key}&plugin=AMap.Driving原创 2021-12-24 10:15:32 · 1975 阅读 · 0 评论 -
vue移动端图片压缩上传,使用lrz
<template> <div class="uploadOutter"> <slot> <div class="uploadInner" @click="$refs.file.click();"> <div class="imgBox" v-if="value&&multiple==false"> <img :src="value" alt class="img".原创 2021-11-10 10:02:15 · 912 阅读 · 0 评论 -
微信登录报错Scope 参数错误或没有 Scope 权限
想要实现微信扫码登录https://open.weixin.qq.com/connect/qrconnect?appid=appid&redirect_uri=redirect_uri&response_type=code&scope=snsapi_login&state=state#wechat_redirect一直报错Scope 参数错误或没有 Scope 权限域名跟认证都实现了的,后来发现原因是只有开放平台申请的原因才有snsapi_login这个功能,上.原创 2021-10-13 13:36:45 · 1488 阅读 · 0 评论 -
一个免费的天气api
原创 2021-06-30 10:30:29 · 92 阅读 · 0 评论 -
Export2Excel.js实现导出excel压缩包
首先在Export2Excel.js文件中引入:importJSZipfrom'jszip'将Export2Excel.js文件最下方的代码saveAs(new Blob([s2ab(wbout)], { type: "application/octet-stream" }), `改成如下代码即可const zip = new JSZip() const zip_name = filename || 'file' const data = new Blob([s...原创 2021-06-22 08:53:54 · 588 阅读 · 1 评论 -
vue 返回上一页不刷新页面且滚动条位置不变
1.不刷新页面:设置路由:{ path: '/room/polling',name: 'roomList',component:()=>import("@/views/room/list.vue"),meta:{ title:'title', keepAlive: true // 需要缓存 }},设置原创 2021-06-10 14:24:13 · 1251 阅读 · 0 评论 -
Failed to launch ‘.....‘ because the scheme does not have
做url跳转的时候报错,网上有说把事件加在div上面,但我就是加在div上,后来发现是因为我是在localhost下跳转的,改成ip跳转就可以了原创 2021-06-03 09:24:29 · 4483 阅读 · 0 评论 -
前端实现调用手机照相机并加辅助框
首先必须是https服务代码如下:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"&g.原创 2021-05-26 11:11:55 · 1586 阅读 · 7 评论 -
前端项目启动https
1.先安装:npm install http-server -g2.跑普通http服务,在命令里执行:hs3.跑普通https服务,需要在当前目录下生产一对 证书 和 密钥:鼠标右击,点击GitBasgHere,在命令里输入: opensslreq-newkeyrsa:2048-new-nodes-x509-days3650-keyoutkey.pem-outcert.pem,回车回车,都执行完后,再在项目的命令里执行:hs -S即可...原创 2021-05-26 10:08:20 · 1491 阅读 · 0 评论 -
移动端输入框获取焦点后,键盘弹出遮住内容问题
focus(name){this.$nextTick(()=>{letdom=document.getElementById(name)setTimeout(()=>{dom.scrollIntoView(true)},500);})}原创 2021-05-06 18:16:07 · 231 阅读 · 0 评论 -
浏览器返回事件监听
mounted(){ //监听注册history.pushState(null,null,document.URL);window.addEventListener('popstate',this.popstate,false)},//监听销毁beforeDestroy(){window.removeEventListener('popstate',this.popstate())},methods:{//监听处理...原创 2021-05-06 11:35:17 · 419 阅读 · 0 评论 -
Export2Excel实现多级表头以及多个sheet页
安装xlsx-style:npm install --save xlsx-style,在\node_modules\xlsx-style\dist\cpexcel.js找到var cpt = require(’./cpt’ + ‘able’);并改成var cpt = cptable;将Export2Excel.js文件修改:import { saveAs } from "file-saver";// import XLSX from "xlsx";import XLSX from "...原创 2021-01-22 15:26:01 · 1770 阅读 · 1 评论 -
将string转为dom
exportfunctionstr2Dom(str){varobjE=document.createElement("div");objE.innerHTML=str;returnobjE;}原创 2020-07-29 14:00:58 · 685 阅读 · 0 评论 -
请求返回文件流格式,实现下载文件功能,前端代码
let _this = this var xhr = new XMLHttpRequest(); let link = process.env.VUE_APP_BASE_API+'/gbgl/downloadDoclist' xhr.open('POST', link, true); // 也可用POST方式 xhr.responseType = "blob"; xhr.onload = function () { ...原创 2020-07-16 11:31:26 · 1296 阅读 · 0 评论 -
js浏览器全屏功能
FullScreen(){ let el = document.getElementById("preivewChartOuttor") this.isFullscreen = !this.isFullscreen if(!this.isFullscreen){//退出全屏 try{ if(document.exitFullscreen){ document.exitFullscreen() .原创 2020-06-08 17:29:13 · 177 阅读 · 0 评论 -
高德地图 transform: rotate(90deg)横屏显示后样式及事件问题
做大屏数据报表,底图用的动态的高德地图,后客户又要求做移动端的大屏,要求用户一进入页面,就是横屏显示。即rotate(90deg)显示页面内容。但是发现旋转后高德地图的样式会有问题。就是创建的marker会被挡住。解决方法:检查元素发现是被amap-layer层挡住,无论怎么设置他的z-index:-1都没有用,后来加了个绝对定位就好了。.amap-layer{z-index:-1!important;position:absolute;}还有就是旋转了之后,高德地图...原创 2020-05-12 08:33:51 · 3138 阅读 · 1 评论 -
使用uuid报错:`const uuidv1 = require('uuid/v1');` is deprecated as of uuid@7.
使用uuid报错:Deep requiring like `const uuidv1 = require('uuid/v1');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules whe...原创 2020-04-14 15:28:39 · 2541 阅读 · 0 评论 -
FileReader 上传并读取文件,实现前端选择文件后读取文件内容
HTML5 的 FileReader 对象允许Web应用程序异步读取存储在用户计算机上的文件(或原始数据缓冲区)的内容,使用 File 或 Blob 对象指定要读取的文件或数据。FileReader 事件 FileReader.onabort 处理abort事件。该事件在读取操作被中断时触发。 FileReader.onerror 处理error事件。该事件在读取操作发生错...原创 2019-12-16 11:17:08 · 458 阅读 · 0 评论 -
JSON.stringify(value[, replacer[, space]])中三个参数详解
参数说明:value: 必需, 要转换的 JavaScript 值(通常为对象或数组)。 replacer: 可选。用于转换结果的函数或数组。 如果 replacer 为函数,则 JSON.stringify 将调用该函数,并传入每个成员的键和值。使用返回值而不是原始值。如果此函数返回 undefined,则排除成员。根对象的键是一个空字符串:""。 如果 replacer...转载 2019-11-27 09:32:15 · 1008 阅读 · 0 评论 -
element cascader 选择任意一级操作面积问题
//给.el-cascader-node__label也加上点击事件mounted(){setInterval(function(){document.querySelectorAll('.el-cascader-node__label').forEach(el=>{el.onclick=function(){...原创 2019-11-13 15:23:40 · 267 阅读 · 0 评论 -
获取地理经纬度计算两点间距离
//距离计算exportfunctiondistance(la1,lo1,la2,lo2){varLa1=la1*Math.PI/180.0;varLa2=la2*Math.PI/180.0;varLa3=La1-La2;varLb3=lo1*Math.PI/180.0-lo2*Math....原创 2019-09-19 11:48:48 · 366 阅读 · 0 评论