咏竹莉
where there is a will,there is a way
posts - 132,comments - 1,views - 66816
06 2021 档案
浏览器宽高、屏幕宽高
摘要:浏览器 浏览器窗口的内部宽: window.innerWidth 浏览器窗口的内部高: window.innerHeight 内部宽高是指去除菜单栏、工具栏、边框等站位元素,用于显示网页的净宽高。 浏览器的整体宽高: window.outerWidth、 window.outerHeight nav 阅读全文
posted @ 2021-06-30 14:32 咏竹莉 编辑
原型继承
摘要:定义个一个函数,把继承的动作封装起来, 这个inherits() 函数可以复用: function inherits(Child, Parent){ var F = function(){}; F.prototype = Parent.prototype; Child.prototype = new 阅读全文
posted @ 2021-06-30 14:19 咏竹莉 编辑
面向对象、创建对象
摘要:// 原型对象 var Student = { name: 'Robot', height: 1.2, run: function(){ console.log(this.name + ' is running') } }; function createStudent(name){ // 基于St 阅读全文
posted @ 2021-06-29 14:42 咏竹莉 编辑
JSON
摘要:json 是一种数据交换格式。 在JSON中,一共有几种数据类型: number: 和js的 number完全一致; boolean: 就是js中的true 或 false; string: 就是js的string; null: 就是js的null array: 就是js的Array 表示方式--[ 阅读全文
posted @ 2021-06-28 17:14 咏竹莉 编辑
vue 中使用多个echarts 适应屏幕缩放
摘要:data () { return { resizeTimer: null, myChart1: null, myChart2: null, myChart3: null, myChart4: null } }, methods: { // 综合得分 雷达图 getScoreChart () { le 阅读全文
posted @ 2021-06-25 17:42 咏竹莉 阅读(321) 评论(0) 推荐(0) 编辑
vue 报EACCES: permission denied, access '/usr/local/lib/node_modules/vue-cli/node_modules/abbrev'错...
摘要:Mac电脑上执行‘ npm install –global vue-cli’命令,报错 原因是无权限,要使用管理员权限 sudo。 解决: sudo npm install -g react-native-cli 阅读全文
posted @ 2021-06-25 17:36 咏竹莉 编辑
Date对象、时间戳转换
摘要:1. 标准时间(即Date() 对象) Mon Sep 16 2019 00:00:00 GMT+0800 (中国标准时间)var now = new Date();now; // Mon Sep 16 2019 00:00:00 GMT+0800 (中国标准时间) 标准时间转时间戳,用getTim 阅读全文
posted @ 2021-06-25 17:31 咏竹莉 编辑
标准对象
摘要:typeof 123; // 'number' typeof NaN; // 'number' typeof 'str'; // 'string' typeof true; // 'boolean' typeof undefined; // 'undefined' typeof Math.abs; 阅读全文
posted @ 2021-06-25 10:19 咏竹莉 编辑
js 处理null、undefined 和空
摘要:var Tools = {}; Tools.removeNullOrUndefined = function (obj) { //typeof 返回的是字符串,有六种可能:"number"、"string"、"boolean"、"object"、"function"、"undefined" if ( 阅读全文
posted @ 2021-06-23 17:17 咏竹莉 编辑
函数-变量作用域与解构赋值
摘要:变量提升 js的函数定义有个特点,它会先扫描整个函数体的语句,把所有申明的变量"提升"到函数顶部: function log(){ var x = 'hello,' + y; console.log(x); // hello, undefined var y = 'world' } log(); 虽 阅读全文
posted @ 2021-06-23 15:18 咏竹莉 编辑
箭头函数
摘要:x=> x*x 上面的箭头函数相当于: function (x) { return x * x } 箭头函数相当于匿名函数,并且简化了函数定义,箭头函数有两种格式,一种上面的,只包含一个表达式,连{...} 和 return 都省略掉了,还有一种包含多条语句,这时候不能省略{...} 和 retur 阅读全文
posted @ 2021-06-21 10:39 咏竹莉 编辑
string 转number number转string
摘要:1. string to number let strz = '123.456' parseInt(strz); // 123 parseFloat(strz); // 123.456 Number(strz); // 123.456 string类型 *1 即可变成number类型 2. numb 阅读全文
posted @ 2021-06-17 17:07 咏竹莉 编辑
高阶函数(map、reduce、filter、sort等)
摘要:1. 先了解abs() 方法 abs()方法可返回函数的绝对值 语法 Math.abs(x) 2. 高阶函数 一个函数可以接收另一个函数作为参数,这种函数称之为高阶函数 // 高阶函数 function add(x,y,f){ return f(x) + f(y) } var add_s = add 阅读全文
posted @ 2021-06-17 10:42 咏竹莉 编辑
mac 管理员权限运行
摘要:sudo 阅读全文
posted @ 2021-06-15 16:58 咏竹莉 阅读(77) 评论(0) 推荐(0) 编辑
函数调用的方法
摘要:函数调用的方法一共有4种: 1. 作为个函数调用 2. 函数作为方法调用 3. 使用构造函数调用 4. 作为函数方法调用 作为一个函数调用 // 作为一个函数调用 var name = "windowsName"; function a() { var name = "Cherry"; consol 阅读全文
posted @ 2021-06-10 17:57 咏竹莉 编辑
ES6 函数的扩展
摘要:1. 函数参数的默认值 基本用法 es6之前,不能直接为函数的参数指定默认值,只能采用变通的方法 function log(x,y) { if (typeof 'undefined') { // 如果y有值,则为y 无值则等于 World y = 'World' } } log('hello') / 阅读全文
posted @ 2021-06-09 10:16 咏竹莉 编辑
ES6 数值的扩展
摘要:1. Number.isNaN() Number.isNaN() 用来检查一个值是否为NaN console.log(Number.isNaN(NaN)); // true console.log(Number.isNaN(12)) // false console.log(Number.isNaN 阅读全文
posted @ 2021-06-08 14:40 咏竹莉 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示