简体   繁体   English

流星JS-多模板Javascript

[英]Meteor JS - Multi-Template Javascript

Working with the Meteor.js framework and trying to implement client js (that requires the DOM to be fully loaded) that must be included across multiple templates. 使用Meteor.js框架并尝试实现必须跨多个模板包含的客户端js(要求DOM完全加载)。 To be specific I am using the hopscotch plugin ( https://github.com/linkedin/hopscotch ) which is essentially a website tour plugin. 具体来说,我使用的是Hopscotch插件( https://github.com/linkedin/hopscotch ),它实际上是一个网站游览插件。 My tour will work across different pages (logically different templates as well.) 我的导览将在不同页面上工作(逻辑上也不同的模板)。

I am very much aware of the template. 我对模板非常了解。 NAME .onRendered hook. NAME .onRendered挂钩。 Since I have more than one template: 由于我有多个模板:

  template.**NAME1**.onRendered(function(){
    //callTourCode

  })

This would not register with template. 这不会向模板注册。 NAME2 ... womp womp NAME2 ... womp womp

Is there any desirable hook to use instead of 是否有任何需要使用的钩子代替

The aldeed:template-extension will fit your needs. aldeed:template-extension将满足您的需求。

Every template onRendered callback: 每个模板onRendered回调:

Template.onRendered(function () {
  //callTourCode
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM