1.0.10 • Published 7 months ago

s-uni-router v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

uniApp router 解决方案

  1. 首屏首次拦截。
  2. 路由全局拦截。

useRouter Api 说明链接

界面生命周期请使用 s-uni-router 导出主要用于首次拦截链接

import { onLoad, onShow, onMounted } from "s-uni-router";

具体使用查看 playground 示例

import { RouterGuards } from "s-uni-router";
const guards = new RouterGuards();
export default function () {
  guards.beforeEach((form, to) => {
    console.log(form, to);
    return new Promise((r, s) => {
      setTimeout(() => {
        r(true);
        //测试
      }, 5000);
    });
  });
}
vite.config.js;
import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import uniRouterLayout from "@s-router-uni/layout";

export default defineConfig({
  plugins: [uniRouterLayout(), uni()],
});
App.vue
<script setup lang="ts">
  import { onRouterReady } from "s-uni-router";

  onRouterReady("/pages/index/index");
</script>

uniRouterLayout 参考 vite-plugin-uni-layouts 实现https://github.dev/uni-helper/vite-plugin-uni-layouts

1.0.10

7 months ago

1.0.2

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago