摘要:
基本用法 在大型项目中,我们可能需要拆分应用为更小的块,并仅在需要时再从服务器加载相关组件。Vue 提供了 defineAsyncComponent 方法来实现此功能: import { defineAsyncComponent } from 'vue' const AsyncComp = def 阅读全文
摘要:
解决的问题 祖孙组件传值 Provide (提供) 要为组件后代提供数据,需要使用到 provide() 函数: <script setup> import { provide } from 'vue' provide(/* 注入名 */ 'message', /* 值 */ 'hello!') < 阅读全文
摘要:
原理 当使用在一个组件上时,v-model 会被展开为如下的形式: <CustomInput :model-value="searchText" @update:model-value="newValue => searchText = newValue" /> 要让这个例子实际工作起来,<Cust 阅读全文