使用自定义文件在VueJS CLI应用程序中实现Socket.IO

时间:2018-10-02 00:42:41

标签: javascript vue.js socket.io

好吧,在下面的链接中,您会找到ccc-streamer-utilities.js和一个名为streamer的文件夹,其中包含stream.js文件。

Here's the link

stream.js管理websocket连接,而ccc-streamer-utilites.js装饰输出并提供帮助程序功能。

我需要做的是包括以下文件,并在Vue CLI应用程序中使用它们。但是,尝试这样做有很多困难。尝试了一周并询问reddit之后,我来了。

这是main.js文件的外观。如果您不愿意提供帮助,请指出正确的方向。

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import Vuetify from 'vuetify'
import 'vuetify/dist/vuetify.min.css'
import VueSocketIO from 'vue-socket.io' //VueJS socket component
import io from 'socket.io-client' //Socket import

Vue.use(Vuetify, VueSocketIO, socket)
Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

该组件看起来像这样

<template>
  <div id="app">
    <div> ... (socket output is determined by element classes and divs [check the two files for more information on this] so ideally, I'd have an implementation that allows me to just input the right class and id's to get the result i want) </div>
  </div>
</template>
.....

Here's an implementation of the client without using VueJS that I did a few months ago while prototyping.

非常感谢您抽出宝贵的时间在这里帮助我,因为我知道我要很多东西。

我的问题:如何在VueJS的单个文件组件中实现stream.js和ccc-streamer-utilities.js提供的实用程序?

0 个答案:

没有答案