【问题标题】:after upgrading to meteor 0.9.1 i keep getting "Warning: Blaze.insert has been deprecated."升级到流星 0.9.1 后,我不断收到“警告:Blaze.insert 已被弃用”。
【发布时间】:2014-09-20 09:17:13
【问题描述】:

您好,我刚刚将我的流星应用升级到 0.9.1.1,我的控制台中不断收到这 2 个警告

W20140910-18:37:07.781(3) (blaze.js:67) Warning: Blaze.render without a parent element is deprecated. You must specify where to insert the rendered content. logging.js:65
W20140910-18:37:07.787(3) (blaze.js:67) Warning: Blaze.insert has been deprecated.  Specify where to insert the rendered content in the call to Blaze.render. logging.js:65

我不知道错误发生在哪里,也不知道为什么会发生。

知道我可能缺少什么吗?

谢谢

【问题讨论】:

  • 请在调用Blaze.insertBlaze.render 的位置发布代码。警告非常清楚,Blaze API 发生了一些变化,您需要考虑这些变化。我怀疑你可能依赖于使用 Blaze API 的包,所以警告不会直接从你自己的代码中产生。
  • 谢谢,其实是iron:router包。这是我应该担心的事情吗?
  • 如果可能,请始终尝试将您的环境更新到最新版本,即我们所说的 METEOR@0.9.1.1 和 iron:router@0.9.3。

标签: meteor meteor-blaze


【解决方案1】:

在流星 0.9+ 中更改了 blaze API 如果你正在使用

 UI.insert(UI.render(Template.foo), document.body)
 UI.insert(UI.renderWithData(Template.foo, {bar: "baz"}), document.body)

您需要更新UI.insert() & UI.insert(UI.renderWithData())

到新的 Blaze API:

Blaze.render(templateOrView, parentNode, [nextNode], [parentView])
Blaze.renderWithData(templateOrView, data, parentNode, [nextNode], [parentView])

查看更新:http://docs-0.9.1.meteor.com/#blaze_render

【讨论】:

    猜你喜欢
    • 2020-04-07
    • 2019-03-05
    • 2014-10-30
    • 2020-06-09
    • 2019-04-28
    • 2023-03-06
    • 2015-10-20
    • 2017-05-10
    • 1970-01-01
    相关资源
    最近更新 更多