1 前置事件注入

  • 项目安装依赖@cvte/cir-lcp-sdk
  • 注入方式参考事件接入,其中事件注入中的code需要与配置的事件名对齐。
  • 前置事件返回格式为: { success: boolean, data?: { url?: string; query?: Record<string, any> },如果没返回data里面的query,则解析url上的${query.字段}会是undefined

2 跳转事件

  • 路由跳转,跳转优先级 __innerRouterJump > history
    • 优先执行注入事件code为:__innerRouterJump, 入参除了正常的ctx,有第二个参数 { url: string }。
    • 支持注入history,跳转时会直接执行history.push事件,注入方式为:
      • 1、安装依赖:@cvte/cir-cache;
      • 2、实例化cache:const cirCache = new CirCache({ storage: 'memory' });
      • 3、设置history:cirCache.setValue('history-cache', history); ,history为系统中实例化后的history,history-cache为key值不可改
  • 跳新tab签,会直接执行window.open事件,不需要开发者做任何事情
作者:黄威鸿  创建时间:2024-09-13 10:20
最后编辑:黄威鸿  更新时间:2025-05-12 18:04