![](https://i-blog.csdnimg.cn/columns/default/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
uni-app
蜗牛君子
这个作者很懒,什么都没留下…
展开
-
uniapp使用websocket通信
简要记录uni-app中使用websocket进行通信1. 初始化定义全局变量webSocketTask: {}onLoad()中使用uni.connectSocket建立websocket长链接this.webSocketTask = uni.connectSocket({ url: common.wsUrl() + ':8082/websocket/' + this.userId, success: () => { console.info("-----原创 2021-03-25 12:57:45 · 3715 阅读 · 2 评论 -
uniapp封装uni-request
新建request.js,其中common存放url等公共资源,userinfo存储token和用户信息等import uniRequest from 'uni-request';import common from "../utils/common.js";import userinfo from './userinfo.js';uniRequest.defaults.baseURL = common.baseUrl();uniRequest.defaults.headers.common原创 2021-03-25 12:28:18 · 789 阅读 · 0 评论