![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JavaScript
文章平均质量分 56
捕获流氓兔
这个作者很懒,什么都没留下…
展开
-
javeScript中this指针的使用
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 javeScript中this指针的使用前言一、this的隐式绑定二、this的显式绑定三、this的式默认绑定四、this的new绑定总结 前言 javascript中的this指向问题,是困扰前端学习的一个重要的问题,this在javascript中主要有显式绑定,隐式绑定,默认绑定,new绑定几种 一、this的隐式绑定 var obj = { name: "name", eating: function() { .原创 2022-04-27 08:50:25 · 866 阅读 · 0 评论 -
react在使用TypeScript编写时遇见“Readonly<{}>“上属性不存在的原因
import { Component} from 'react' import React from "react" import {Age} from "./age" export const UserContext = React.createContext({ name: "Alex", age: 26 }) //定义一个接口,目的是为后面的state提供类型,以便通过编译器的检查 interface test { name:'john', age:18 } //这里的any用来定义原创 2020-10-29 11:31:01 · 4045 阅读 · 0 评论 -
apply和call和bind区别
var person = { name: "axuebin", age: 25 }; function say(job){ console.log(this.name+":"+this.age+" "+job); } say.call(person,"FE"); // axuebin:25 FE say.apply(person,["FE"]); // axuebin:25 FE var sayPerson = say.bind(person,"FE");原创 2020-10-28 11:10:03 · 75 阅读 · 0 评论