Meteor breadcrumb

前端 未结 2 1439
清酒与你
清酒与你 2021-02-10 00:59

How do I implement a reactive breadcrumb with Meteor and iron-router?

Now I\'m looking for the current path, triggered by a reactive session variable and then adding eac

2条回答
  •  故里飘歌
    2021-02-10 01:17

    You can call Router.current().path inside a helper function and it will return the current path. Then split the path on / and return the array to your breadcrumbs template. The function is reactive, so updates will propagate:

    Template.breadcrumbs.path = function() {
      return Router.current().path.split( "/" );
    }
    

提交回复
热议问题