随笔分类 - js
摘要:1. 返回结果不一样 for in 返回数组的key for of 返回数组的value var nums:number[] = [1001,1002,1003,1004] // for in for (var key in nums) { console.log(key) } // 输出: /**
阅读全文
摘要:图片加载时或者加载失败处理(vue) //课评系统在index.js 中添加自定义组件 //全局注册自定义指令,用于判断当前图片是否能够加载成功,可以加载成功则赋值为img的src属性,否则使用默认图片 // index.js Vue.directive('real-img', async func
阅读全文
摘要:将页面导出pdf 在课堂评测系统v3版本中有用到,代码如下 /** * 导出PDF * @ dom 导入pdf 内容 */ toPDF: function (dom) { let pdfContentHeight = dom.offsetHeight; let pdfContentWith = do
阅读全文
摘要:图片压缩上传 imgUpload: function () { var that = this; var eleFile = document.querySelector('#upload'); // 压缩图片需要的一些元素和对象 var reader = new FileReader(), img
阅读全文
摘要:jQuery的deferred对象详解 (1) $.Deferred() 生成一个deferred对象。 getVideoList: function(curriculumid) { let deferred = $.Deferred(); var that = this; var params =
阅读全文
摘要:效果图 步骤 1.需要在文件跟目录下新建img文件夹,添加对应图片; 2.新建index.html,复制下面代码 <html> <head> <meta charset="utf-8"> <title>旋转相册</title> <style> body { width: 100%; margin:
阅读全文
摘要:效果图 代码 <!DOCTYPE html> <html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <body > <div id="content" style="height:500px;widt
阅读全文
摘要:HTML页面导出成PDF功能 该功能网上一抓一大把,可以上网搜索,添加看这个((https://blog.csdn.net/weixin_34406061/article/details/88883210)),写的相对比较详细。 工作常常见问题 黑屏 导出区域的dom可能存在错误,如图片地址不正确,
阅读全文

浙公网安备 33010602011771号