vue#defineAsyncComponent TypeScript Examples

The following examples show how to use vue#defineAsyncComponent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: utils.ts    From hexon with GNU General Public License v3.0 8 votes vote down vote up
export function useAsyncComponentWithLoading(
  loader: Parameters<typeof defineAsyncComponent>[0]
): [ReturnType<typeof defineAsyncComponent>, ComputedRef<boolean>] {
  const loading = ref(true)
  const _loader = "loader" in loader ? loader.loader : loader
  return [
    defineAsyncComponent(() =>
      _loader().then((res) => {
        loading.value = false
        return res
      })
    ),
    computed(() => loading.value),
  ]
}
Example #2
Source File: vgrid.ts    From vue3-datagrid with MIT License 6 votes vote down vote up
VGrid = defineAsyncComponent(
  () => new Promise<typeof RevoGrid>((resolve) => {
    if (!isDefined && loader) {
      loader.defineCustomElements();
      isDefined = true;
    }
    return resolve(RevoGrid);
  })
)
Example #3
Source File: dispatcher.ts    From hexon with GNU General Public License v3.0 5 votes vote down vote up
HCreateArticleModal = defineAsyncComponent(
  () => import("@/modals/HCreateArticleModal.vue")
)
Example #4
Source File: dispatcher.ts    From hexon with GNU General Public License v3.0 5 votes vote down vote up
HSettingsModal = defineAsyncComponent(
  () => import("@/modals/HSettingsModal.vue")
)