vue3 [Vue warn]
```runtime-core.esm-bundler.js:40 [Vue warn]: Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with markRaw
or using shallowRef
instead of ref
.文章来源:https://www.toymoban.com/news/detail-639721.html
<script setup>
import {ref} from "vue";
import Home from "./views/Home.vue";
import Users from "./views/Users.vue";
//selectPage默认值null
const selectPage = ref(null);
const changeSelectPage = (page) => {
selectPage.value = page;
}
changeSelectPage(Home)
</script>
<template>
<div>
<button type="button" class="btn btn-primary" @click="changeSelectPage(Home)">首页</button>
<button type="button" class="btn btn-primary" @click="changeSelectPage(Users)">用户</button>
<!--动态组件-->
<component :is="selectPage"></component>
</div>
</template>
解决方案
文章来源地址https://www.toymoban.com/news/detail-639721.html
到了这里,关于runtime-core.esm-bundler.js:40 [Vue warn]: Vue received a Component which was made a reactive object的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!