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

@luckycode/vue-chat-button

v0.0.12

Published

Vue 3 chat button components with badge support, modal popup, fixed positioning, environment configuration, and customizable themes

Readme

Vue Chat Button

Vue 3 聊天按钮组件,支持徽章、弹窗、固定定位、环境配置和自定义主题。

安装

npm install vue-chat-button
# 或
yarn add vue-chat-button
# 或
pnpm add vue-chat-button

使用方法

全局注册

import { createApp } from 'vue'
import VueChatButton from 'vue-chat-button'
import 'vue-chat-button/dist/vue-chat-button.css'

const app = createApp(App)
app.use(VueChatButton)
app.mount('#app')

组件单独使用

<template>
  <div>
    <!-- 简单聊天按钮 -->
    <ChatButtonSimple :theme-color="#1890ff" @click="handleClick" />

    <!-- 带徽章的聊天按钮 默认固定在屏幕右下角 -->
    <ChatButtonWithBadge @click="handleClick" />
  </div>
</template>

<script setup>
import { ChatButtonSimple, ChatButtonWithBadge } from 'vue-chat-button'
import 'vue-chat-button/dist/vue-chat-button.css'

const handleClick = () => {
  console.log('聊天按钮被点击')
}
</script>

组件 API

ChatButtonSimple

简单聊天按钮组件。

Props

| 属性 | 类型 | 默认值 | 说明 | | ------------- | ------------------------------- | --------------- | ------------- | | iconUrl | string | '' | 自定义图标URL | | themeColor | string | '#1890ff' | 主题颜色 | | environment | 'development' \| 'production' | 'development' | 环境配置 |

Events

| 事件名 | 参数 | 说明 | | ------- | ---- | ------------ | | click | - | 按钮点击事件 |

ChatButtonWithBadge

带徽章的聊天按钮组件。

Props

| 属性 | 类型 | 默认值 | 说明 | | ----------------- | -------------------------------------------------------------- | ------------------ | -------------------- | | badgeCount | number | 0 | 徽章数量 | | badgeColor | string | '#ff4d4f' | 徽章颜色 | | themeColor | string | '#1890ff' | 主题颜色 | | iconUrl | string | '' | 自定义图标URL | | isFixed | boolean | false | 是否固定定位 | | fixedPosition | 'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left' | 'bottom-right' | 固定位置 | | fixedOffset | { x?: number; y?: number } | { x: 20, y: 60 } | 固定位置偏移 | | autoFetch | boolean | true | 是否自动获取徽章数量 | | fetchInterval | number | 30000 | 获取间隔(毫秒) | | enablePolling | boolean | true | 是否启用轮询 | | pollingInterval | number | 30000 | 轮询间隔(毫秒) | | environment | 'development' \| 'production' | 'development' | 环境配置 | | params | any | undefined | 请求参数 |

Events

| 事件名 | 参数 | 说明 | | -------------- | --------------- | ---------------- | | click | - | 按钮点击事件 | | badgeUpdate | count: number | 徽章数量更新事件 | | pollingStart | - | 轮询开始事件 | | pollingStop | - | 轮询停止事件 | | error | error: any | 错误事件 |

Methods

| 方法名 | 参数 | 返回值 | 说明 | | ----------------------- | ------------------ | --------------- | ---------------- | | fetchBadgeCount | - | Promise<void> | 手动获取徽章数量 | | setBadgeCount | count: number | void | 设置徽章数量 | | startPolling | - | void | 开始轮询 | | stopPolling | - | void | 停止轮询 | | updatePollingInterval | interval: number | void | 更新轮询间隔 |

ChatModal

聊天弹窗组件。

Props

| 属性 | 类型 | 默认值 | 说明 | | ---------------- | ------------------------------------- | ------------ | ---------------- | | visible | boolean | false | 是否显示弹窗 | | iframeUrl | string | '' | iframe URL | | modalTitle | string | '在线客服' | iframe 标题 | | position | 'right' \| 'center' \| 'fullscreen' | 'right' | 弹窗位置 | | width | string | '400px' | 弹窗宽度 | | height | string | '600px' | 弹窗高度 | | closeOnOverlay | boolean | true | 点击遮罩是否关闭 | | closeOnEscape | boolean | true | 按ESC是否关闭 |

Events

| 事件名 | 参数 | 说明 | | ---------------- | ---------------- | -------------- | | update:visible | value: boolean | 可见性更新事件 | | open | - | 弹窗打开事件 | | close | - | 弹窗关闭事件 |

Methods

| 方法名 | 参数 | 返回值 | 说明 | | -------- | ---- | ------ | ------------ | | open | - | void | 打开弹窗 | | close | - | void | 关闭弹窗 | | toggle | - | void | 切换弹窗状态 |

环境配置

组件支持环境配置,可以自动切换API地址等配置:

import { getEnvironmentConfig } from 'vue-chat-button'

const config = getEnvironmentConfig('production')
console.log(config.apiBaseUrl)

许可证

MIT