2
我想知道如何访问同一类内的私人静态字段,假设类不是导出。打字稿访问同一类内的私人静态字段
module Test {
class Template {
private static ext = '.hbs';
private static basePath = 'WebContent/templates/';
private static templatesFolder = 'templates';
private static partialsFolder = 'partials';
private static paymentMethodsFolder = 'paymentMethods';
public static template(templateName, data): string{
return Handlebars.templates[Test.Template.basePath + this.templatesFolder + '/' + templateName + this.ext];
}
}
}
我不知道如何访问static template
函数中的静态变量。我不想导出类,因为我想封装逻辑,所以它在浏览器中不可用。
这是怎么回事?我从this
开始,因为它起初不是静态的,但我改变了主意,现在我被卡住了。
这很容易,我知道它必须是可能的,只是忘了该怎么做!谢谢。 – Vadorequest 2015-03-31 13:52:31