when the elementUI tab page is switched, the corresponding tab-pane component I use the dynamic component, and then I find that it only triggers the mounted event, and there is no event trigger when I leave.
before-leave, with tab tag finds that oldActiveName can"t get it, so it will error undefine.
and sometimes when the page comes in, before-leave triggers the entry of the first tag multiple times when the first page does an action. The great god took a look at what went wrong. The code is as follows,
<div class="company-page">
<el-tabs v-model="activeName" type="card" :before-leave="clearTime(activeName,oldActiveName)" @tab-click="handleClick">
<el-tab-pane :key="item.tapKey" v-has="item.tapKey" v-for="(item, index) in actList" :label="item.tapName" :name="item.tapKey">
</el-tab-pane>
</el-tabs>
<main class="pageBox main">
<component :ref="activeComponent" :is="activeComponent"></component>
</main>
</div>