Can't load components using VueJS

I'm trying to use dynamic import but nothing is happening

this is my code :

<component :is="state.name"/>
<button @click="onClick">Click me !</button>

setup() {
  const state = reactive({
  name: computed(() => isShow.value == true ? import('./b.vue'): import('./a.vue'))
  });

  const isShow = ref(false);
  const onClick = () => {
    console.log(5)
    isShow.value = true;
  }

  return {
    state,
    onClick
  }
},

and here is my b & a components

b
<script>
export default {
    data(){},
    created(){
        alert('lol')
    }
}
</script> 

Please I need a help to load my components programatically



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation