【问题标题】:what is the use of get in "Class { get isFunction(){ } }"? [duplicate]“Class { get isFunction(){ } }”中的 get 有什么用? [复制]
【发布时间】:2016-05-02 09:39:58
【问题描述】:

拥有 javascript 类:

export class PartyDetails extends MeteorComponent {
    constructor(params:RouteParams) {
        super();
    }
    get isOwner(): boolean {
        if (this.party && this.user) {
            return this.user._id === this.party.owner;
        }    
        return false;
    }    
}

get 用于get isOwner() 的目的是什么

【问题讨论】:

标签: javascript meteor


【解决方案1】:

Get 是创建属性的语法的一部分。看看documentation for properties

【讨论】:

    猜你喜欢
    • 2018-06-09
    • 2021-09-23
    • 2016-11-08
    • 2013-09-05
    • 2011-03-29
    • 1970-01-01
    • 1970-01-01
    • 2020-08-27
    • 2011-05-07
    相关资源
    最近更新 更多