🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more
Socket
Book a DemoInstallSign in
Socket

@pubinfo/module-template

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pubinfo/module-template

pubinfo framework module template

latest
npmnpm
Version
0.0.15
Version published
Maintainers
3
Created
Source

module-template

这个模板生动形象的展示了如何让我们编写的 module,让他可以天然的支持 V1 和 V2。

项目结构

src/
├── components/     # 组件目录
│   └── HelloWorld.vue  # 示例组件
├── pages/          # 页面目录
│   └── Demo.vue    # 演示页面
├── router/         # 路由配置
│   └── index.ts    # 路由定义
├── index.ts        # 模块导出入口
├── v1.ts           # V1版本模块实现
└── v2.ts           # V2版本模块实现

模块说明

本模块模板提供了一个完整的pubinfo模块示例,包括:

  • 组件导出与复用
  • 路由注册与配置
  • V1和V2版本模块实现

使用方法

组件使用

import { HelloWorld } from 'module-template'

// 在模板中使用
<HelloWorld msg="欢迎使用" />

页面使用

import { DemoPage } from 'module-template'

V2模块集成

import { withModule } from 'module-template/v2'

// 在pubinfo应用中注册
app.use(pubinfo, {
  modules: [
    withModule()
  ]
})

路由说明

模块预配置了以下路由:

  • /demo-module - 展示演示页面,路由名称为 DemoModule

路由包含白名单配置,可以在未登录状态下访问。

V2版本特性

V2版本模块实现了:

  • 路由自动注册
  • 登录状态管理
  • 路由拦截与重定向

在应用加载时,模块会自动注册路由并处理相关的路由拦截逻辑。

FAQs

Package last updated on 10 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts