constructor(
public templateHeaderRow = 'DefaultTableHeaderTemplate',
public templateBodyRow = 'DefaultTableRowTemplate',
private templateBase = _templateBase) {
require([this.templateBase + templateHeaderRow + '.html', this.templateBase+ templateBodyRow + '.html'], () => console.log('fdsfdsdfsf'));
}
それから私はそれを次のように呼んでいます:log = new ListViewBase(undefined,'LoggingTableRowTemplate');
で少しばかげているよう(undefined,'
です。別のデザインを提案できる人はいますか?
私ができるC#のようなもので(parametername:value, another:value2)
、オプションのパラメータの順序は関係ありません。ただし、タイプスクリプトでそのようなものは見つかりませんでした。
アップデート
代替私はこれをやっています:
public templateHeaderRow = 'DefaultTableHeaderTemplate';
public templateBodyRow = 'DefaultTableRowTemplate';
private templateBase = _templateBase;
constructor(configuration? : ListViewBaseConfiguration) {
if (typeof configuration !== "undefined") {
if (typeof configuration.templateBase !== "undefined")
this.templateBase = configuration.templateBase;
if (typeof configuration.templateBodyRow !== "undefined")
this.templateBodyRow = configuration.templateBodyRow;
if (typeof configuration.templateHeaderRow !== "undefined")
this.templateHeaderRow = configuration.templateHeaderRow;
}
require(['template!' + this.templateBase + this.templateHeaderRow + '.html',
'template!' + this.templateBase + this.templateBodyRow + '.html']);
}
しかし、一部のパラメーターを設定でき、他のパラメーターを設定できないという動作を得るには、さらに多くのコードを記述する必要があります。