JZTXT
  • 首页
  • Ai
  • Java
  • Python
  • Android
  • Mysql
  • JavaScript
  • Html
  • CSS

this指向

发布时间 2023-05-30 16:27:59作者: 芬-mi

this 的指向,是当我们调用函数的时候确定的。调用方式的不同决定了this 的指向不同

  1. 普通函数this在非严格模式下指向window,严格模式下指向undefined
  2. 构造函数this指向实例对象,原型对象里面的方法也指向实例对象
  3. 对象方法中的this指向该方法所属的对象
  4. 事件绑定方法中的this指向绑定该事件的对象
  5. 定时器函数的this指向window
  6. 立即执行函数中的this指向window
    本栏目推荐文章
  • 2024-01-13 Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. ==》引用了未使用的方法导致
  • [Vue warn]: Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".
  • vue报错:Module parse failed: Unexpected token (5:2) You may need an appropriate loader to handle this file type.
  • About this page
  • JavaScript this 绑定详解
  • JavaScript this 绑定详解
  • react 事件函数中 this 绑定问题
  • mysql--You must reset your password using ALTER USER statement before executing this statement
  • keil 工程编译报错browse infomation of one or more files is not available: ……Doing a project rebuild might fix this.
  • python jira 取提出指向未解决的问题
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们