The code is quite simple. However, I am facing an issue where the about component cannot 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 have tested this in a vue2 project using JS and vue2.6.11, and everything seems to work fine as usual.
Do you think it could be a bug or am I missing something? Your input would be greatly appreciated. Thank you.