相关疑难解决方法(0)

在Javascript/Typescript中"让_self = this"意味着什么?

在这段代码片段中,为什么它this.identifier不起作用但_self.url有效?

  getConfig() {
    let _self = this;
    return function () {
      this.page.url = this.url || window.location.href;
      this.page.identifier = _self.identifier;
      this.page.category_id = this.categoryId;
      this.language = this.lang;
    };
}
Run Code Online (Sandbox Code Playgroud)

因此,没有let _self = this真正做?

javascript typescript angular

13
推荐指数
2
解决办法
4555
查看次数

标签 统计

angular ×1

javascript ×1

typescript ×1