🚀
高性能
基于 Vue 3 Composition API 构建,支持响应式更新和智能缓存
EwVueComponent 是一个专为 Vue 3 设计的动态组件包装器,它解决了在复杂应用中动态切换组件的痛点,提供了优雅的解决方案。
<template>
<EwVueComponent
:is="currentComponent"
v-bind="componentProps"
@error="handleError"
>
<template #default>
<p>默认插槽内容</p>
</template>
<template #header>
<h2>头部插槽</h2>
</template>
</EwVueComponent>
</template>
<script setup>
import { ref } from 'vue'
import { EwVueComponent } from 'ew-vue-component'
const currentComponent = ref('div')
const componentProps = ref({ class: 'my-component' })
const handleError = (error) => {
console.error('组件加载失败:', error)
}
</script>
立即开始使用 EwVueComponent,体验现代化的 Vue 3 开发: