after upgrading to meteor 0.9.1 i keep getting “Wa

2019-07-27 09:31发布

问题:

Hi I just upgraded my meteor app to 0.9.1.1 and I keep getting these 2 warnings in my console

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

I have no idea from where the error occurs, or why it happens.

Any idea of what I might be missing ?

Thanks

回答1:

The blaze API changed in meteor 0.9+ If you are using

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

You need to update UI.insert() & UI.insert(UI.renderWithData())

to the new Blaze API:

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

Check updates: http://docs-0.9.1.meteor.com/#blaze_render