华域联盟 JavaScript vue activated在子组件中的使用详情

vue activated在子组件中的使用详情

页面:base:

<template>
  <div class="tab-container">
    <h1 style="text-align: center">
      申请{{ form.category }}{{ form.companyType }}入驻
    </h1>
    <div class="form-panel" style="margin-left: 20px;text-align: right;">
      <el-button type="info" @click="cancelSave">取消</el-button>
      <el-button type="warning" @click="transientSave">暂存</el-button>
      <el-button type="danger" @click="persistSave">保存</el-button>
    </div>
    <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card" :before-leave="collectPaneFormData" @tab-click="initPaneData">
      <el-tab-pane v-for="item in tabMapOptions" :key="item.key" :label="item.label" :name="item.key">
        <keep-alive>
          <tab-pane :is="item.key" :ref="item.key" :type="item.key" @create="showCreatedTimes" />
          <!--<component :is="item.key" :ref="item.key" :type="item.key" @create="showCreatedTimes" />-->
        </keep-alive>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

有五个tab-pane, 其中三个子组件中有activated方法。这三个子组件中都有连接跳转到person, 当在person中进行:this.$router.go(-1)

    // 取消,关闭返回
    cancelSubmit() {
      // 调用全局挂载的方法,关闭当前页
      this.$store.dispatch('tagsView/delView', this.$route)
      this.$router.go(-1)
    },

这时三个子组件的activated方法都会执行吗?如何只让跳转到person中的哪个子组件的activated方法执行,其它两个不执行activated方法

到此这篇关于vue activated在子组件中的使用详情的文章就介绍到这了,更多相关vue activated在子组件中的使用内容请搜索华域联盟以前的文章或继续浏览下面的相关文章希望大家以后多多支持华域联盟!

本文由 华域联盟 原创撰写:华域联盟 » vue activated在子组件中的使用详情

转载请保留出处和原文链接:https://www.cnhackhy.com/146843.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们