Vue-CLI access is used in VUE to implement instant messaging

I am stupid Gou. Recently, the company has to develop a mobile app. It is necessary to use Vue combined with the project development of WebPack + ES6. It is necessary to use the instant communication function of Yunyun. I look forward to the mother, I found this type of article. Very few, I also spent a lot of time to figure out how it is what is going on, then talk less nonsense, directly on the code, tell Xiaobai how to operate.

First, you must register, this stupid operation does not say, the registration will get AppKey and the clouds provided token (this token is generally When the backend is returned, we will return to us in the background. It is not our business. If you really want to get through the cloud, I will say it later).

Many beginners beginning of time will not start to see the document around, you will see the following:


See here, of course, we have developed app To use the local document, don’t say, directly open download and look at what ghost, open the directory is as follows,


This is the file we are looking for, we are as long as the latest The version, take these three files, (of course, you can also directly quote the SDK of their outer chain), the outer chain is of course no local.

Next, after we acquired SDK, how to use it, how to put it into our Vue-CLI project combined with our projects, the SDK, the cloud is written by ES5, Next, how do we use it to use the code we write with ES6, here’s official website does not explain.

Let’s put these three pieces into our project, first put the


files under the static directory, Protobuf-2.2.8.min.js file is placed in the src directory (here you are free, usually in the company’s JS file) and then we open just downloaded backFolder, open the HTML file inside, see how they achieve,

Ok, here, you have seen it, It is here to introduce

rongimlib-2.2.9.min.js vue中使用vue-cli接入融云实现即时通信 This file, here, let us first know how to use this JS file,

We first open the project catalog The lower index.html file

introduced in

, we can The RongimClient variable is used in the .vue file, but the introduced JS introduced is global, the first page can access our RongimClient, of course, it also takes up performance, I recommend introducing here, because I am instant chat project, many places To share the monitoring of rongimclient, if you don’t want to reference JS in the global reference, please see another article, ES6 introduced the JS


The above is the Vue-CLI access to the cloud to realize instant communication using the Vue-CLI access to the VUE. I hope that if you have any questions, please leave a message, Xiaobian, please Will reply to everyone in time. Thank you very much for your support of Tumi Cloud Website!
If you think this article helps you, welcome to reprint, please indicate the source, thank you!

© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment