npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@qiankunjs/vue

v0.0.1-rc.1

Published

vue binding for qiankun

Downloads

8

Readme

qiankun vue binding

Usage

npm i @qiankunjs/vue

MicroApp 组件

直接通过 组件加载(或卸载)子应用,该组件提供了 loading 以及错误捕获相关的能力:

<script setup>
import { MicroApp } from '@qiankunjs/vue';
</script>
<template>
  <micro-app name="app1" entry="http://localhost:8000" />
</template>

当启用子应用加载动画或错误捕获能力时,子应用接受一个额外的样式类 wrapperClassName,渲染的结果如下所示:

<div :class="wrapperClassName">
  <MicroAppLoader :loading="loading" />
  <ErrorBoundary :error="e" />
  <MicroApp :class="className" />
</div>

加载动画

启用此能力后,当子应用正在加载时,会自动显示加载动画。当子应用挂载完成变成 MOUNTED 状态时,加载状态结束,显示子应用内容。

直接将 autoSetLoading 作为参数传入即可:

<script setup>
import { MicroApp } from '@qiankunjs/vue';
</script>
<template>
  <micro-app name="app1" entry="http://localhost:8000" autoSetLoading />
</template>

自定义加载动画

如果您希望覆盖默认的加载动画样式时,可以通过 loader slot 来自定义加载组件 loader 作为子应用的加载动画。

<script setup>
import CustomLoader from '@/components/CustomLoader.vue';
import { MicroApp } from '@qiankunjs/vue';

</script>
<template>
  <micro-app name="app1" entry="http://localhost:8000" >
     <template #loader="{ loading }">
       <custom-loader :loading="loading">
     </template>
  </micro-app>
</template>

其中,loading 为 boolean 类型参数,为 true 时表示仍在加载状态,为 false 时表示加载状态已结束。

错误捕获

启用此能力后,当子应用加载出现异常时,会自动显示错误信息。可以向子应用传入 autoCaptureError 属性以开启子应用错误捕获能力:

<script setup>
import { MicroApp } from '@qiankunjs/vue';
</script>
<template>
  <micro-app name="app1" entry="http://localhost:8000" autoCaptureError />
</template>

自定义错误捕获

如果您希望覆盖默认的错误捕获组件样式时,可以通过 errorBoundary slot 来自定义子应用的错误捕获组件:

<script setup>
import CustomErrorBoundary from '@/components/CustomErrorBoundary.vue';
import { MicroApp } from '@qiankunjs/vue';

</script>
<template>
  <micro-app name="app1" entry="http://localhost:8000" >
     <template #error-boundary="{ error }">
       <custom-error-boundary :error="error">
     </template>
  </micro-app>
</template>

组件属性

| 属性 | 必填 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | --- | | name | 是 | 微应用的名称 | string | | entry | 是 | 微应用的 HTML 地址 | string | | autoSetLoading | 否 | 自动设置微应用的加载状态 | boolean | false | | autoCaptureError | 否 | 自动设置微应用的错误捕获 | boolean | false | | className | 否 | 微应用的样式类 | string | undefined | | wrapperClassName | 否 | 包裹微应用加载组件、错误捕获组件和微应用的样式类,仅在启用加载组件或错误捕获组件时有效 | string | undefined |

组件插槽

| 插槽 | 说明 | | --------------- | ------------ | | loader | 加载状态插槽 | | errorBoundary | 错误捕获插槽 |