<template>
  <div class="app-container">
    <h1>App 根组件</h1>
    <hr />

    <button @click="currentComponent = 'Left'">展示左组件</button>
    <button @click="currentComponent = 'Right'">展示右组件</button>
    <div class="box">
      <!-- 渲染 Left 组件和 Right 组件 -->
     
      <KeepAlive exclude="myRight">

        <component :is="currentComponent"></component>
      </KeepAlive>

    </div>
  </div>
</template>

<script>
import Left from './components/Left.vue';
import Right from './components/Right.vue';
export default {
  data() {
    return {
      currentComponent: '',
    }
  },
  components: {
    Left,
    Right
  }
}
</script>

<style scoped>
.app-container {
  padding: 1px 20px 20px;
  background-color: #efefef;
}

.box {
  display: flex;
}
</style>
