Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

博主你好,在尝试复现该程序的是否遇到问题给我造成较长事件的困扰希望得到你的帮助。 #1

Closed
jimisun123 opened this issue Nov 27, 2021 · 2 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@jimisun123
Copy link

我在尝试复现此程序时候,操作步骤是这样的。

  1. 安装
"vue-socket.io": "^3.0.10",
  1. 配置
Vue.use(Vant,
    new VueSocketIO({
        debug: false, // debug调试,生产建议关闭
        connection: "http://localhost:9999",
        vuex: {
            store,
            actionPrefix: 'SOCKET_',
            mutationPrefix: 'SOCKET_'
        },
        options: {     //Optional options,
            autoConnect: false,       // 自动连接     这里为我项目需求  需要在指定情况下才连接socket
            path: "/ws",
            transports: ['websocket']
        }
    })
)
  1. 尝试在组件中发送事件
 this.$socket.emit("hell","hello")

结果 浏览器控制台打印如下
image

希望得到你的帮助.....thanks

@wf0
Copy link
Owner

wf0 commented Nov 28, 2021

你好啊,我复现了你的问题:
image


Vue.use(ElementUI,
new VueSocketIO({
debug: false, // debug调试,生产建议关闭
connection: "http://localhost:3000",
vuex: {
store,
actionPrefix: 'SOCKET_',
mutationPrefix: 'SOCKET_'
},
options: { //Optional options,
autoConnect:false, //关闭自动连接,在用户登录后在连接。
}
})
);

是这样的,vue使用插件建议分开use,问题应该是你将你的vant跟socketIO放在一个use中去注册使用了。
你可以分开写:Vue.use(A).use(B),看看能不能使用socket进行通信。如果不行,再反馈,我再帮你看看~期待回复。

@wf0 wf0 self-assigned this Nov 29, 2021
@wf0 wf0 added the help wanted Extra attention is needed label Nov 29, 2021
@OnZeng
Copy link

OnZeng commented May 13, 2022

博主能加下我QQ嘛 qq:2528358258 救命

@wf0 wf0 closed this as completed Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants