Should I use Meteor.startup() or $(function() {})

前端 未结 2 1484
悲&欢浪女
悲&欢浪女 2021-01-08 00:35

Do they do the same thing ?

Which one should I use inside client?

if ( Meteor.is_client ) {
    Meteor.startup(function () {
        // my code here
         


        
2条回答
  •  渐次进展
    2021-01-08 01:04

    I just ran into an issue that $ was called before template rendering so I hade to use Meteor.startup

    So I'd say that if you need to work with DOM elements you have to use Meteor.startup (I used it for the jQuery File Upload plugin)

提交回复
热议问题