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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jctrans-materials/comps-vue2

v1.0.37

Published

JCtrans Search Component compatible with Vue 2.6+ and Vue 3

Readme

Vue2 组件说明(jc-utils)

组件清单

当前 packages/vue2 对外导出的核心组件如下:

  • ApplyDataDialog
  • GlobalModal
  • JcSearch
  • JcVerifySlide
  • JcCarrierSearch
  • AirCarrierSearch
  • SeaCarrierSearch
  • AirLineSearch
  • SeaLineSearch

快速使用

import Vue from "vue";
import JCtransComps from "@jctrans-materials/comps-vue2";
import "@jctrans-materials/comps-vue2/style.css";

Vue.use(JCtransComps);

如果你在 Vue 2.6 环境下使用,请额外安装并注册 @vue/composition-api;Vue 2.7 及以上版本不需要这一步。

组件能力速览

1) JcSearch

  • 用途:国家/城市/港口/机场等通用地点搜索
  • 常用 Props:value / modelValuemultiplesearchTypeListhistoryKey
  • 常用事件:selectchangeinputupdate:modelValue

2) JcVerifySlide

  • 用途:滑块验证码验证
  • 常用 Props:visiblelangmodeimgSizebarSize
  • 常用事件:successupdate:visible

3) JcCarrierSearch 及包装组件

  • 用途:承运人/航线搜索(海运、空运)
  • 常用 Props:value / modelValuetypelineTypemultipleshowApplyData
  • 常用事件:
    • 业务:changeapply
    • 输入框:focusblurremove-tag

包装组件:

  • AirCarrierSearch(航空公司)
  • SeaCarrierSearch(船公司)
  • AirLineSearch(空运航线)
  • SeaLineSearch(海运航线)

4) ApplyDataDialog

  • 用途:申请补充数据弹窗
  • 常用 Props:value
  • 常用事件:confirminput / update:value

5) GlobalModal

  • 用途:全局业务弹窗容器(配合插件/事件总线)

Playground 示例

可在以下页面查看 Vue2 组件演示:

  • playground/v2play/src/App.vue
    • Base DemoJcSearch + ApplyDataDialog + GlobalModal
    • Carrier Search DemoJcCarrierSearch 系列
    • Verify Slide DemoJcVerifySlide

GIO 埋点接入(Vue2)

1) 按需启用(不传配置即不启用)

import Vue from "vue";
import JCtransComps from "@jctrans-materials/comps-vue2";

Vue.use(JCtransComps, {
  tracking: {
    enabled: true,
    autoInit: true,
    directiveName: "gio-track",
    accountId: process.env.VUE_APP_GIO_ACCOUNT_ID,
    dataSourceId: process.env.VUE_APP_GIO_DATA_SOURCE_ID,
    appId: process.env.VUE_APP_GIO_APP_ID,
    initOptions: {
      debug: process.env.NODE_ENV !== "production",
      trackPage: false,
      serverUrl: process.env.VUE_APP_GIO_SERVER_URL,
    },
  },
});

如果不传 tracking,则不会初始化 GIO。

2) 指令与 API 用法

<button v-gio-track="'order_submit'">提交订单</button>

<button
  v-gio-track="{
    event: 'order_submit',
    attrs: { source: 'cart' },
    onTracked: ({ eventName }) => console.log(eventName),
  }"
>
  提交并回调
</button>
this.$trackEvent("manual_track", { source: "manual" });
this.$gio.track("direct_track", { source: "direct" }, () => {
  console.log("done");
});

3) 配置优先级

  1. window.__JCTRANS_GIO_CONFIG__(或 globalVarName 指定对象)
  2. tracking 传入配置
  3. import.meta.env.VITE_GIO_*

4) GIO 单测(Vue2)

测试文件:src/gio.test.ts

覆盖点:

  • 初始化分支:
    • appId(4 参数 init
    • appId(3 参数 init
    • 缺少必填配置时不初始化
  • 指令行为:bind / update / unbind 的绑定、重绑、清理
  • 回调行为:onTrackedtrack 回调后触发
  • 暴露能力:$trackEvent$gio 常用 API

结合 GrowingIO WebJS 常用 API 文档(含 trackTimerStart)对齐了以下接口可用性:

  • setUserId
  • clearUserId
  • setVisitor
  • trackTimerStart
  • trackTimerEnd

运行方式:

pnpm -C packages/vue2 test:run