Aurelia:翻译+参数来自值转换器

Aurelia: translate + parameter comes from value converter

我使用值转换器来格式化日期格式:

${date | formatDate}

接下来我想使用这个格式化的日期作为翻译参数。像这样:

${'dateOfCreation' | t: {'date': ${date | formatDate}}}

但是没用。甚至有可能在 Aurelia 做到这一点吗?如果没有,我应该怎么做?

谢谢!

遗憾的是,Aurelia 目前不支持嵌套值转换器。您可以使用此作为解决方法:

<div ref="myDiv" formatted-date="${date | formatDate}">
  ${'dateOfCreation' | t: { 'date': myDiv.formattedDate } }
</div>

希望对您有所帮助!