Ember升级:Mixins的计划是什么,特别是bufferedProperty?

我正在处理 COMPATIBILITY: move thumbnail selector to Glimmer & new Component modal system by merefield · Pull Request #32 · merefield/discourse-tc-topic-list-previews · GitHub

我之前在 Modal Controller 上使用了 bufferedProperty,但现在为了支持新的 Component modal 架构,我不得不迁移到一个 Component。

但是,我认为我仍然需要使用 bufferedProperty(我正在更新 Topic Meta 中的一个值)。

然而,这会引发一个错误:

export default class AwesomeModalComponent extends Component.extend(
  bufferedProperty("model")
) {

…然后我得到 TypeError: n.default.extend is not a function

我找到了一些关于这种模式的例子,但仅限于 Controllers:

很高兴知道关于“TODO”的计划是什么。

3 个赞

最简单的短期解决方案是:继续使用 Classic Component 来处理你的模态框(即不是 Glimmer 组件)。Classic Components 仍然支持 mixins。

坚持使用 classic component(即 Converting modals from legacy controllers to new DModal component API 中描述的策略)将为你提供与旧的基于 controller 的系统最干净的 1:1 升级。

从长远来看,我们需要为一些核心 mixins 找出替代方案。但我们还没有完全做到这一点。

4 个赞

为了跟进并表示感谢。我使用了完全相同的方法并成功解决了所有问题 - 我将除模态本身之外的所有内容都移到了 Glimmer,而模态需要 Mixin。

顺便说一下,bufferedProperty 似乎执行了很多魔法,并且似乎不遵循与传递更改相关的任何标准规则!

1 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.