当前位置: 首页>前端>正文

vue3动态组件

Index.vue:

<script setup>
import { ref, onMounted } from 'vue'
import Child from './Child.vue'
import './index.css'

onMounted(() => {})
</script>

<template>
  <div class="m-home-wrap">
    <component :is="Child"></component>
    <div class="m-home-demo"></div>
  </div>
</template>

<style></style>

Child.vue:

<template>
  <div>子组件</div>
</template>

<script setup></script>

<style></style>

vue3动态组件,vue3动态组件_前端,第1张


https://www.xamrdz.com/web/2d41960218.html

相关文章: