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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@irooty/vue-global-events

v0.3.10

Published

> 全局用户事件插件

Downloads

3

Readme

vue-global-events npm npm

全局用户事件插件

该插件使用 Vue 3 + 版本

English | 简体中文

安装插件

npm install @irooty/vue-global-events --save

使用插件

import request from './libs/request' // 请引入你的 Request
import GlobalEvents from '@irooty/vue-global-events';
// 全局注册
Vue.use(GlobalEvents,{request: request});

插件使用方法:

let data = {
    ucType: _UserEvents.subjectType.POSTS, // 题材类型 “帖子”
    // ... 其它参数
}; // 用户参数
_UserEvents.like(data);
// 或
this._$like(data);
// 或
this.$onUserEvent(_UserEvents.eventType.LIKE,data);

参数

用户参数

let data = {
    msgId: 'String', // 事件ID
    platAppId: 'String', // 企业ID、公众号ID
    platType: 'String', // 应用标识 ewc:企业微信,mp:公众号
    agentId: 'String', // 企业应用ID  企业微信有值,其它无
    userId: 'String', // 用户ID
    ucType: 'String', // 题材类型,请查看_UserEvents.subjectType
    commentId: 'int', // 评论ID
    secId: 'int', // 栏目ID
    readPercent: 'String', // 阅读进度
    staySecond: 'String', // 停留时间(s)
    createTime: 'Date' // 事件时间
}; 

属性

eventType

用户事件类型, 使用方式:_UserEvents.eventType.VIEWS.

  • type: Enum
  • value: String
枚举列表
  • CLICK: 点击(浏览)
  • LIKE: 点赞
  • ULIKE: 取消点赞
  • FAV: 收藏
  • UFAV: 取消收藏
  • SHARE: 分享
  • USHARE: 取消分享
  • COMMENT: 评论
  • UCOMMENT: 取消评论
  • STAY: 停留
  • PV: 浏览百分比
  • JOIN: 参与
  • OTHER: 其它
  • SEND: 发帖

subjectType

内容题材类型, 使用方式:_UserEvents.subjectType.ARTICLE.

  • type: Enum
  • value: String
枚举列表
  • ARTICLE: 图文
  • POSTS: 帖子
  • COMMENT: 评论
  • EXAM: 答题
  • ANSWER: 问卷
  • VOTE: 投票
  • SECTION: 栏目

方法

所有方法列表

// 点击(浏览)
_UserEvents.click(data);
// 点赞
_UserEvents.like(data);
// 取消点赞
_UserEvents.ulike(data);
// 收藏
_UserEvents.favorite(data);
// 取消收藏
_UserEvents.ufavorite(data);
// 分享
_UserEvents.share(data);
// 取消分享
_UserEvents.ushare(data);
// 评论
_UserEvents.comment(data);
// 取消评论
_UserEvents.ucomment(data);
// 停留
_UserEvents.stay(data);
// 浏览百分比
_UserEvents.pv(data);
// 参与
_UserEvents.join(data);
// 其它
_UserEvents.other(data);
// 发帖
_UserEvents.send(data);

/*  ====== 或 ====== */
// 点击(浏览)
this._$click(data);
// 点赞
this._$like(data);
// 取消点赞
this._$ulike(data);
// 收藏
this._$favorite(data);
// 取消收藏
this._$ufavorite(data);
// 分享
this._$share(data);
// 取消分享
this._$ushare(data);
// 评论
this._$comment(data);
// 取消评论
this._$ucomment(data);
// 停留
this._$stay(data);
// 浏览百分比
this._$pv(data);
// 参与
this._$join(data);
// 其它
this._$other(data);
// 发帖
this._$send(data);

/*  ====== 或 ====== */
this.$onUserEvent(_UserEvents.eventType.LIKE,data); // 点赞

开发步骤

# 安装依赖
npm install

# 热部署 localhost:8080
npm run dev

# 打包
npm run build

# 打包成插件
npm run build:lib

# 发布插件
npm publish --access public

# 强制移除发布
npm unpublish @irooty/vue-global-events --force

For detailed explanation on how things work, consult the docs for vue-loader.