App.vue 587 B

1234567891011121314151617181920212223242526
  1. <script vapor>
  2. import { ref } from 'vue'
  3. import VdomComp from './components/VdomComp.vue'
  4. window.calls = []
  5. window.getCalls = () => {
  6. const ret = window.calls.slice()
  7. window.calls = []
  8. return ret
  9. }
  10. const show = ref(true)
  11. const toggle = ref(true)
  12. </script>
  13. <template>
  14. <div class="render-vdom-component">
  15. <button class="btn-show" @click="show = !show">show</button>
  16. <button class="btn-toggle" @click="toggle = !toggle">toggle</button>
  17. <div>
  18. <KeepAlive v-if="show">
  19. <VdomComp v-if="toggle"></VdomComp>
  20. </KeepAlive>
  21. </div>
  22. </div>
  23. </template>