继承中最重要的两个地方:设置原型和构造函数的引用 将”子类“原型指向父类的原型 Teacher.prototype = Object.create(Person.prototype); 将”子类“原型上的 constructor 属性指向子类构造函数 Teacher.prototype.constr ...
分类:
编程语言 时间:
2020-07-05 17:17:26
阅读次数:
63
1、toString() 第一选择 let obj = {} Object.prototype.toString.call(obj) '[Object Object]' 2、constructor let obj = {} obj.constructor Object 3、instanceof 注意 ...
分类:
编程语言 时间:
2020-07-04 19:14:18
阅读次数:
549
装包:npm install jquery --save 方式一 全局使用 1)main.js中引入 // jquery import $ from 'jquery' Vue.prototype.$ = $; 2)更改vue.config.js const webpack = require('we ...
分类:
Web程序 时间:
2020-07-03 19:12:59
阅读次数:
76
每个原型链的终点为Object,Object的原型为null. 1.每个函数都有一个prototype属性指向原型对象。 2.函数的原型对象开始时只有constructor属性,当函数作为构造函数时,constructor属性指向原函数 3.使用构造函数创建对象实例时: 1)创建一个空对象{} 2) ...
分类:
其他好文 时间:
2020-07-03 00:51:51
阅读次数:
54
var type = function (o){ var s = Object.prototype.toString.call(o); return s.match(/\[object (.*?)\]/)[1].toLowerCase(); }; ['Null', 'Undefined', 'Obj ...
分类:
Web程序 时间:
2020-07-02 14:51:56
阅读次数:
111
前言 JQ的链式操作大家玩的都很熟悉了,但是底层是如何进行这般骚操作的? 之前我曾经想过在方法体把this返回出去,这样就可以方法().方法()这样执行下去,可以执行里面的业务逻辑,但是问题在于,我们要处理的值,怎么传给下一个方法? 案例 Object.prototype.toUpper = fun ...
分类:
其他好文 时间:
2020-07-02 13:27:49
阅读次数:
39
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...
分类:
编程语言 时间:
2020-07-01 22:06:42
阅读次数:
61
1 String.prototype.endWith=function(str){ 2 if(str==null||str==""||this.length==0||str.length>this.length) 3 return false; 4 if(this.substring(this.le ...
分类:
其他好文 时间:
2020-07-01 14:16:51
阅读次数:
83
1 String.prototype.startWith=function(str){ 2 if(str==null||str==""||this.length==0||str.length>this.length) 3 return false; 4 if(this.substr(0,str.le ...
分类:
其他好文 时间:
2020-07-01 14:13:47
阅读次数:
83
Avoided redundant navigation to current location: 避免了对当前位置的冗余导航 倒是不影响之后的操作 百度了解决方案,在 引用vue-router 的js 中添加以下代码 const originalPush = Router.prototype.pu ...
分类:
其他好文 时间:
2020-07-01 12:45:07
阅读次数:
133