Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在客户端和服务器端之间共享代码。我不希望客户端可以在本地计算数据的服务器往返,但我还需要验证服务器端的数据。由于服务器上没有 emberjs,所以我使用普通的 JS 对象。我可以将它转换为客户端的混合,以便我可以将函数混合到我的模型对象中吗?
您可以通过在 Ember.Mixin.create() 中包装 JS 对象字面量来创建 Ember mixin。这就是创建了多少个内部 mixin,包括 Enumerable 等。