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

js中的this

发布时间 2023-05-09 19:46:53作者: HuangBingQuan

js中的this指向

  • 首先this是动态的,在函数调用前是无法预知的,只有函数被调用后this才被确定。

函数调用的5种情况

  1. 通过对象调用函数,this指向对象
  2. 直接调用函数,this指向全局对象
  3. 如果通过new调用函数,this指向新创建的对象
  4. 如果通过apply、call、bind调用函数,this指向指定的数据
  5. 如果是DOM事件函数,this指向事件源
    本栏目推荐文章
  • 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.
  • 修改账户密码时提示 ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement 错误
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们