![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
前端
柴智霖
这个作者很懒,什么都没留下…
展开
-
防止单个js文件引入后被污染的方法
var exportedData_ = {};functiondeepCopy(obj,cache=[]){//如果为普通数据类型,则直接返回,完成拷贝if(obj===null||typeofobj!=="object"){returnobj}//cache用来储存原始值和对应拷贝数据,在递归调用deepCopy函数时,如果本次拷贝的原始值在之前已经拷贝了,则直接返回储存中的copy值,//这样的话就不用再循...原创 2022-02-21 17:30:34 · 278 阅读 · 0 评论 -
vite vue3 src import 动态导入失败解决方法
1.使用import.meta.globEager()const getSrc = (name) => { const path = `/static/icon/${name}.svg`; const modules = import.meta.globEager("/static/icon/*.svg"); return modules[path].default; };2.在computed属性中使用动态路径 var imagePath = .原创 2021-10-18 11:51:29 · 6172 阅读 · 0 评论 -
vue echarts更新数据方法
<template><divstyle="width:30%;height:30%"><divstyle="width:100%;height:100%"id="container"></div></div></template><script>import*asechartsfrom'echarts';exportdefault{...原创 2021-09-28 17:43:45 · 1270 阅读 · 0 评论 -
js ajax 前端跨域问题最简单的解法
采用nginx转发端口就行了前端代码:$.ajax({type:"GET",async:true,dataType:'json',url:"http://123.123.123.123:12004/api/robot/another...", //这里的api是必须的,服务器IP为123.123.123.123crossDomain:true,processData:false,//用于对data参数进行序列化处理这...原创 2021-08-27 11:29:17 · 226 阅读 · 0 评论 -
vue的watch监听引用类型数据失败的解决办法
<template> <div> <div>child:</div> <div>修改前:{{oldUser}} 修改后:{{user}}</div> </div></template><script>export default { name: 'child', props: ['user'], data () { return { old...原创 2021-08-17 11:57:13 · 365 阅读 · 0 评论 -
angular 中断HTTP请求
由于angular的HTTP请求返回promise类型的数据,通过subscribe()方法来接收返回数据,因此可以通过调用取消订阅 unsubscribe()方法来实现中断HTTP请求。实现方法用例:subscribes:any;getChannels() {}this.subscribes = this._service.getChannels(connectionName).subscribe((channels: any) => {如果是通过循环调用HTTP请求,...原创 2021-07-23 14:15:43 · 448 阅读 · 0 评论 -
angular 自定义打包文件名
node_modules\@angular\cli\models\webpack-configs\common.js修改打包后的js文件名称node_modules\@angular\cli\models\webpack-configs\styles.js修改打包后的css文件名称作者:意外金喜链接:https://www.zhihu.com/question/57280102/answer/297620209来源:知乎著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处原创 2021-06-08 17:56:51 · 766 阅读 · 0 评论 -
Springboot-web net::ERR_ABORTED 404
script标签的src值和link标签的href值都必须从static目录的下一层(即子目录)开始,否则会被spring boot拦截,导致404原创 2021-01-26 14:26:25 · 331 阅读 · 1 评论 -
angular post请求Content-Type为application/x-www-form-urlencoded时,后台接受的数据为null
post请求的请求体有以下两种格式:字符串: ‘name=code_bunny&age=12’这种格式的请求体,需要配置请求头 ‘Content-Type’:‘application/x-www-form-urlencoded’json: {name:‘code_bunny’,age:12}这种格式的请求体,需要配置请求头 ‘Content-Type’:‘application/json;charset=UTF-8’在jquery的ajax中,默认都是第一种,虽然在写请求体参数原创 2021-01-19 15:50:23 · 935 阅读 · 0 评论 -
解读浮动闭合 clearfix
.clearfix{overflow:auto;_height:1%}把這段代碼添加到你的css文件,或者把花括號裏面的内容添加到你的style屬性中。原创 2021-01-04 16:38:29 · 87 阅读 · 0 评论 -
后台接收不到前端传的参数
传到后端后的数据未进行编码,使用 this.url = encodeURI(this.url) 方法进行http路径采用encodeURI进行编码就行。原创 2020-12-08 10:06:57 · 1922 阅读 · 2 评论 -
Angular2-除了自定义标签,你还可以这样配置组件的选择器
开发应用时,UCD给到我们的样式经常使用子类选择器“>”,如果所有组件都用自定义的标签选择器,开发人员无疑要对很多样式做调整。Angular2组件化除了自定义标签,还可以在selector元数据里配置样式、属性的调用方式。selector总共有6种配置方式:selector: ‘element-name’//自定义标签选择器selector: ‘.class’//样式选择器selector: ‘[attribute]’//属性选择器selector: ‘[attribute=value]’/转载 2020-11-26 17:23:31 · 198 阅读 · 0 评论 -
angular 实现HTTP请求中断
由于angular的HTTP请求返回promise类型的数据,通过subscribe()方法来接收返回数据,因此可以通过调用取消订阅 unsubscribe()方法来实现中断HTTP请求。实现方法用例:subscribes:any;getChannels() {this.subscribes = this._service.getChannels(connectionName).subscribe((channels: any) => { ......原创 2020-11-25 16:39:48 · 872 阅读 · 0 评论 -
Uncaught TypeError: i.getOtherAxis is not a function
echarts 3没有带地图数据,手动导入china.js或者其他geojson数据,echarts官网的源码中有地图数据,在map文件夹下原创 2020-09-23 11:54:43 · 1592 阅读 · 0 评论 -
利用jsonp解决js读取本地json跨域的问题
本文主要给大家介绍了关于使用jsonp解决js读取本地json跨域的相关内容,分享出来供大家参考学习,下面话不多说了,来一起看看详细的介绍吧一 、问题描述通过ajax方式读取本地json文件,谷歌浏览器会提示跨域错误,导致获取不到json数据。跨域报错.pngajax获取json数据代码:$.ajax({url: “file/employeejson.json”,//json文件位置type: “GET”,//请求方式为getdataType: “json”, //返回数据格式为jsons原创 2020-09-23 11:23:20 · 965 阅读 · 0 评论 -
angular route 路由嵌套 通配路由 空白路由 使用教程
根路由写法实例:constroutes:Routes=[{path:'login',loadChildren:'./auth/auth.module#AuthModule'}, // loadChildren值为auth文件夹下的auth.module.ts文件,#后面跟的是类名。];@NgModule({imports:[RouterModule.forRoot(routes,{enableTracing:false})], //forRo...原创 2020-08-05 10:32:13 · 541 阅读 · 0 评论 -
ngx-datatable 自动改变宽度 resize recalculate
import { DatatableComponent } from "@swimlane/ngx-datatable";import {AfterContentChecked, ChangeDetectorRef, Directive} from "@angular/core";@Directive({ selector: '[ngx-resize-watcher]' })export class NgxResizeWatcherDirective implements AfterContent.原创 2020-07-28 20:42:06 · 555 阅读 · 0 评论 -
ng-template 上下文交互
在模版内的表单中通过[(ngModel)]绑定上下文变量,实现上下文交互<ng-template #conditionValue let-row="row" let-value="value"> <div style="width: 80%;"> <input type="number" class="form-control m-inp...原创 2019-03-21 17:41:40 · 2232 阅读 · 0 评论 -
angular中如何获取被引用组件内的方法
步骤:设置一个变量,将其用ViewChild装饰, 将该变量的类型设定为被引用组件的类名(class 后面的那个单词),如注释B中所释代码 调用该变量,采用变量名+“." 的方式调用该变量内的方法,如注释C中所释代码。import {Component, OnInit, ViewChild} from "@angular/core";import {FormComponent} f...原创 2019-05-05 15:51:12 · 2365 阅读 · 0 评论 -
angular表单自定义校验验证
在formConfig的每个key对应的value中的验证方法部分填写验证规则代码,也可抽象成方法以登录密码验证为例:const _config = { id: [, , , {label: '', class: 'col-md-12 col-lg-12', hidden: true, type: 'static'}], code: [, , , {label: '员工编...原创 2019-05-08 12:31:46 · 2640 阅读 · 1 评论 -
在angular中引用jquery
1.在命令行界面输入npm install --save jquerynpm install @types/jquery --save2.在相应ts文件导入美元符号$:declare let $: any;原创 2019-05-30 10:54:33 · 497 阅读 · 0 评论 -
input select 复合输入框实现
使用datalist标签实现 input select功能<input list="_select" class="form-control m-input" [formControl]="_ctrl" placeholder="{{_ctrl['$context$']['placeholder']}}"><datalist id...原创 2019-06-06 11:57:30 · 1829 阅读 · 0 评论 -
主流浏览器下载后台返回的blob文件
直接上代码:this._fileService.downLoadFile(data).subscribe((data: Blob)=> { console.log('queryAttachment',data); if ('msSaveOrOpenBlob' in navigator){ //IE10+时,走这里下载 window.navigator....原创 2018-11-30 15:18:37 · 3736 阅读 · 0 评论