使用 vent.js 传递参数.如何在触发事件后加载的下一个页面视图中读取该数据

passing parameters using vent.js. How can I read that data in the next page-view that will load after the event is triggered?

本文关键字:下一个 加载 视图 数据 读取 事件 js vent 参数 使用      更新时间:2023-09-26

我有这个观点

define(['marionette', 'tpl!templates/profiles/_profile_item.html','vent'], function(Marionette, template,vent) {
  var ProfileItemView = Marionette.ItemView.extend({ 
    template: template,
    events: {
        "click button": function() {
            // alert(this.model.get('name') + " was clicked!");
        if(this.model.get('name')=='Guest')
          vent.trigger('navigate','player');
        else if(this.model.get('name')=='Create profile')
          vent.trigger('navigate','createProfile');
        else
          vent.trigger('navigate','loginProfile',{
                      name: this.model.get('name')
                      });
        }
    }
  });
  return ProfileItemView;
});

在 else 中,我触发导航并传递一些数据。我的问题是如何在触发事件后加载的下一个页面视图中读取该数据?

    vent.on('navigate', this.someFunction);
    someFunction:function(e){
        // e your data
    }