The code are very simple. The about component can not be rendered.
<template>
<div id="nav">
<button @click="sh = !sh">{{ sh }}</button>
<p v-if="sh">v-if</p>
<about v-if="sh" />
</div>
</template>
<script lang="ts">
import { defineComponent, ref } from "vue";
export default defineComponent({
components: {
about: () => import("@/views/About.vue")
},
setup() {
const sh = ref(false);
return {
sh
};
}
// data: () => ({
// sh: false
// })
});
</script>
I tried it in vue2 project(JS+vue2.6.11), it worked fine just like always.
Is it a bug or I got something wrong? Thank you.