【问题标题】:i18n on custom elements with @bindable does not work with 't.bind'带有@bindable 的自定义元素上的 i18n 不适用于“t.bind”
【发布时间】:2017-07-12 12:09:53
【问题描述】:

我注意到https://github.com/aurelia/i18n/issues/123 中已修复了一个类似问题。但在 't/i18n' 中,文字值是个问题。

但我遇到了“t.bind”的问题 我们有一个用例,我们需要构造表达式并将其绑定到 't/i18n'

例如:

<template> <my-custom-element t.bind="messagekey" t-params.bind="{ param1: 10, param2: 10 }"></my-custom-element> <my-custom-element t.bind="messagekey"></my-custom-element> </template>

在视图模型中,我们如下构造消息键:

this.messagekey = "[title]content_key";

当您运行应用程序时,不会向自定义元素写入任何内容。

但是,我尝试使用带有文字值的 't';

<template> <my-custom-element t="[title]content_key" t-params.bind="{ param1: 10, param2: 10 }"></my-custom-element> <my-custom-element t="[title]content_key"></my-custom-element> </template>

它成功了。

有人可以帮助我吗?

【问题讨论】:

    标签: aurelia


    【解决方案1】:

    只是为了处理这个问题,这听起来像是与 i18n 插件无关的副作用。 https://github.com/aurelia/i18n/issues/226

    【讨论】:

      猜你喜欢
      • 2021-12-07
      • 2014-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-06
      • 2015-11-02
      相关资源
      最近更新 更多