# Helper 插件助手

版本:1.13.0

开发:高明君

# 安装

$ npm i @hui-pro/helper -D
# 或者
$ yarn add @hui-pro/helper --dev

# 引入

import Helper from '@hui-pro/helper';
基础用法
<template>
  <el-button type="default" @click="start">
    启动
  </el-button>
</template>
<script>
  import Helper from '@hui-pro/helper';
  import { Message, MessageBox } from 'hui';
  export default {
    methods: {
      start() {
        const helper = new Helper(); //new Helper({ wsPort:XXX });
        helper
          .startApp('commentcmd')
          .then(res => {
            // 成功
            Message('连接成功');
          })
          .catch(err => {
            // 失败
            MessageBox.confirm('检测到未安装插件助手,请点击下载。', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'question'
            })
              .then(() => {
                Message('前往下载');
              })
              .catch(() => {
                Message('取消下载');
              });
          });
      }
    }
  };
</script>

# API

# Attributes

参数 说明 类型 可选值 默认值
ws-port ws 连接端口 Number - 18000
wss-port wss 连接端口 Number - 18001