[3.6]Mayday: Is there any way to create panel with view and init & get this view instance?


#1

I want to get the view instance after panel(including the view layout) opened

<script 
        on:{
            panelOpen: function () {
                if(this.$app.views.length<2){ 
                    this.$app.views.create('.view-left', {
                        url: '/leftPanel/',
                    });
                }
                console.log(this.$app.views.current); 
                **// Only the first time the view.view-left is returned but every other time it is main view,why?**
            },
        }

#2

this.$app.views.get('.view-left');


#3

but that view was never created,coz the panel with this view was loaded dynamic


#4
<template>
  <div class="panel">
    <div class="view">
      ...
    </div>
  </div>
</template>
<script>
  return {
    // ...
    mounted: function () {
      var app = this.$app;
      app.views.create(this.$el.find('.view'), {
        url: '/leftPanel/',
      });
    },
    // ...
  }
</script>

#5

Thank you very much for your reply.

Does the panel have “mounted” event?
But I still can’t get the full idea of how to load a panel with a view.

Since view.main can be loaded automatically,
but the panel can only be encoded outsides of page layout.

Therefore, I hope you can provide a clearer or completely solution