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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-simple-chat

v1.1.94

Published

A Vue component about chat

Downloads

33

Readme

vue-simple-chat

一个基于 [signalR]的 Vue 聊天组件

功能

  • 在线聊天

  • 附件上传(文件+图片)待开发

  • 聊天记录查看 待开发

安装

npm install @aspnet/signalr
npm i element-ui -S
npm install vue-simple-chat --save

笔记周边

  • 待写todo

使用

初始化

import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui';
import  'element-ui/lib/theme-chalk/index.css'
import chat from 'vue-simple-chat'

Vue.use(ElementUI)
Vue.use(chat)

/* eslint-disable no-new */
new Vue({
  render(createElement) {
    return createElement(App)
  }
}).$mount('#app')

App.vue

<template>
<div>
  <chat :data="chatData" :sendData="sendData" :options="options" ref="chat" 
     @getRefreshVoteStatus="getRefreshVoteStatus" @getVoteResult="getVoteResult" @getNotification="getNotification"></chat>
  用户名称<input type="text" v-model="options.sender">
  用户ID<input type="text" v-model="options.curUserId">
  <el-button @click="startConnect">{{options.connectFlag == '1' ? '断开' : '连接'}}</el-button>
</div>
</template>

<script>
  export default {
    name:'app',
    data () {
      return {
        chatData:[],//聊天容器
        options:{
            targetApiUrl:'',//目标api地址  required
            roomId:'',//加入的房间id required
            curUserId:'',//当前用户的id required
            sender:'',//发送人姓名 required
            sendContent:'',//发送内容
            avatarUrl:'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',//用户头像
            role:'',//用户角色
            connectFlag:-1,//用这个来控制连接开关,1开2关 required
        },
        sendData:{
          methodName:'',//方法
          connectObject:{}//传入的数据
        },
      }
    },
    methods: {
      startConnect(){
        if(this.options.connectFlag  == 1){
          this.options.connectFlag =2
        }else{
          this.options.connectFlag =1
        }
      },
      //获取状态
      getRefreshVoteStatus(val){},
      //获取投票结果
      getVoteResult(val){},
      //获取后端返回消息
      getNotification(val){
        console.log('val',val)
      },
    },
  }
</script>
 

组件

Props

  • options {Object}

    必填配置项:

    • targetApiUrl{String} 目标api地址

    • roomId{String} 加入的房间id

    • curUserId{String} 当前用户的id

    • sender{String} 发送人姓名

    • connectFlag{Number} 用这个来控制连接开关 1开2关

    此外,你可以有如下配置项可选:

    • sendContent{String} 发送内容

    • avatarUrl{String} 用户头像 示例:'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png' (无传入值则显示该头像)

    • role{String} 用户角色

  • data [Array]

    默认:

    []

    作为聊天框容器,可以传入需要显示的历史聊天数据。

  • sendData {Object}

    必填配置项:

    • methodName{String} 对应后端invoke的方法名字

    • connectObject{String | Object} 对后端invoke的方法的传参

事件

注意:

  • getRefreshVoteStatus 获得投票状态

  • getVoteResult 获取投票结果

  • getNotification 获得返回消息

Development

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report