提交 bae26471 作者: 方治民

style: 添加 antfu eslint-config

上级 045c9851
...@@ -10,7 +10,12 @@ module.exports = { ...@@ -10,7 +10,12 @@ module.exports = {
jsx: true, jsx: true,
}, },
}, },
extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], extends: [
'@antfu',
'plugin:vue/vue3-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
rules: { rules: {
'vue/script-setup-uses-vars': 'error', 'vue/script-setup-uses-vars': 'error',
'@typescript-eslint/ban-ts-ignore': 'off', '@typescript-eslint/ban-ts-ignore': 'off',
...@@ -62,5 +67,6 @@ module.exports = { ...@@ -62,5 +67,6 @@ module.exports = {
}, },
], ],
'vue/multi-word-component-names': 'off', 'vue/multi-word-component-names': 'off',
'no-console': 'off',
}, },
} }
import fs from 'fs' import fs from 'node:fs'
import path from 'path' import path from 'node:path'
import dotenv from 'dotenv' import dotenv from 'dotenv'
export function isDevFn(mode: string): boolean { export function isDevFn(mode: string): boolean {
...@@ -40,7 +40,7 @@ export function wrapperEnv(envConf: Recordable): ViteEnv { ...@@ -40,7 +40,7 @@ export function wrapperEnv(envConf: Recordable): ViteEnv {
*/ */
function getConfFiles() { function getConfFiles() {
const script = process.env.npm_lifecycle_script const script = process.env.npm_lifecycle_script
const reg = new RegExp('--mode ([a-z_\\d]+)') const reg = /--mode ([a-z_\d]+)/
const result = reg.exec(script as string) as any const result = reg.exec(script as string) as any
if (result) { if (result) {
const mode = result[1] as string const mode = result[1] as string
......
import path from 'node:path'
import type { Plugin } from 'vite' import type { Plugin } from 'vite'
import path from 'path'
// https://github.com/antfu/unplugin-auto-import // https://github.com/antfu/unplugin-auto-import
import AutoImport from 'unplugin-auto-import/vite' import AutoImport from 'unplugin-auto-import/vite'
...@@ -39,7 +39,7 @@ export function configComponentsImportPlugin(): Plugin { ...@@ -39,7 +39,7 @@ export function configComponentsImportPlugin(): Plugin {
(name: string) => { (name: string) => {
// FIX: 修复 easycom 在 APP 下不生效问题(原因不明 // FIX: 修复 easycom 在 APP 下不生效问题(原因不明
if (name.startsWith('fui-')) { if (name.startsWith('fui-')) {
return path.resolve(__dirname, `src/components/firstui/${name}/${name}.vue`).replaceAll('\\', '/') return path.resolve(__dirname, `src/components/FirstUI/${name}/${name}.vue`).replaceAll('\\', '/')
} }
// if (name.startsWith('uni-')) { // if (name.startsWith('uni-')) {
// return `@dcloudio/uni-ui/lib/${name}/${name}.vue` // return `@dcloudio/uni-ui/lib/${name}/${name}.vue`
......
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
"vue-types": "^5.0.2" "vue-types": "^5.0.2"
}, },
"devDependencies": { "devDependencies": {
"@antfu/eslint-config": "^0.37.0",
"@commitlint/cli": "^17.4.4", "@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4", "@commitlint/config-conventional": "^17.4.4",
"@dcloudio/types": "^3.3.2", "@dcloudio/types": "^3.3.2",
...@@ -106,6 +107,7 @@ ...@@ -106,6 +107,7 @@
"@dcloudio/uni-helper-json": "^1.0.13", "@dcloudio/uni-helper-json": "^1.0.13",
"@dcloudio/uni-stacktracey": "3.0.0-alpha-3070720230316001", "@dcloudio/uni-stacktracey": "3.0.0-alpha-3070720230316001",
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3070720230316001", "@dcloudio/vite-plugin-uni": "3.0.0-alpha-3070720230316001",
"@iconify/json": "^2.2.36",
"@types/lodash-es": "^4.17.7", "@types/lodash-es": "^4.17.7",
"@types/mockjs": "^1.0.7", "@types/mockjs": "^1.0.7",
"@types/node": "^18.15.3", "@types/node": "^18.15.3",
......
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
}) })
onError((err) => { onError((err) => {
Message.toast('App Error: ' + err) Message.toast(`App Error: ${err}`)
}) })
onUnhandledRejection((err) => { onUnhandledRejection((err) => {
Message.toast('App UnhandledRejection: ' + err) Message.toast(`App UnhandledRejection: ${err}`)
}) })
</script> </script>
......
...@@ -30,10 +30,10 @@ export const Message = { ...@@ -30,10 +30,10 @@ export const Message = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// #ifndef APP-PLUS // #ifndef APP-PLUS
uni.showModal({ uni.showModal({
title: title, title,
content: message, content: message,
showCancel: false, showCancel: false,
confirmText: confirmText, confirmText,
success: () => resolve(), success: () => resolve(),
fail: (err) => reject(err), fail: (err) => reject(err),
}) })
...@@ -56,10 +56,10 @@ export const Message = { ...@@ -56,10 +56,10 @@ export const Message = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// #ifndef APP-PLUS // #ifndef APP-PLUS
uni.showModal({ uni.showModal({
title: title, title,
content: message, content: message,
showCancel: showCancel, showCancel,
confirmText: confirmText, confirmText,
success: (res) => resolve(res.confirm), success: (res) => resolve(res.confirm),
fail: (err) => reject(err), fail: (err) => reject(err),
}) })
......
<template>
<view class="empty" :style="[{ background: bgColor }]">
<!-- 暂无数据/空数据 -->
<image src="../../static/images/empty.png" />
<!-- 提示内容 -->
<view class="empty-tips" :style="[{ color: tipsColor }]">{{ tips }}</view>
</view>
</template>
<script> <script>
export default { export default {
props: { props: {
...@@ -24,6 +16,16 @@ ...@@ -24,6 +16,16 @@
}, },
} }
</script> </script>
<template>
<view class="empty" :style="[{ background: bgColor }]">
<!-- 暂无数据/空数据 -->
<image src="../../static/images/empty.png" />
<!-- 提示内容 -->
<view class="empty-tips" :style="[{ color: tipsColor }]">{{ tips }}</view>
</view>
</template>
<style> <style>
.empty { .empty {
width: 100%; width: 100%;
......
<script lang="ts" setup> <script lang="ts" setup>
import type { PropType } from 'vue' import type { PropType } from 'vue'
import { nanoid } from 'nanoid' import { nanoid } from 'nanoid'
import { isImage, isVideo, getPoster } from './utils' import { getPoster, isImage, isVideo } from './utils'
type URLs = { url: string }[] type URLs = { url: string }[]
const props = defineProps({ const props = defineProps({
......
...@@ -17,5 +17,5 @@ export function getPoster(url: string) { ...@@ -17,5 +17,5 @@ export function getPoster(url: string) {
return url return url
} }
return url + '.jpg' return `${url}.jpg`
} }
import { i18n } from '/@/locales' import { i18n } from '/@/locales'
type I18nGlobalTranslation = { interface I18nGlobalTranslation {
(key: string): string (key: string): string
(key: string, locale: string): string (key: string, locale: string): string
(key: string, locale: string, list: unknown[]): string (key: string, locale: string, list: unknown[]): string
...@@ -37,9 +37,13 @@ export function useI18n(namespace?: string): { ...@@ -37,9 +37,13 @@ export function useI18n(namespace?: string): {
const { t, ...methods } = i18n.global const { t, ...methods } = i18n.global
const tFn: I18nGlobalTranslation = (key: string, ...arg: any[]) => { const tFn: I18nGlobalTranslation = (key: string, ...arg: any[]) => {
if (!key) return '' if (!key) {
if (!key.includes('.') && !namespace) return key return ''
// @ts-ignore }
if (!key.includes('.') && !namespace) {
return key
}
// @ts-expect-error
return t(getKey(namespace, key), ...(arg as I18nTranslationRestParameters)) return t(getKey(namespace, key), ...(arg as I18nTranslationRestParameters))
} }
return { return {
......
...@@ -3,6 +3,7 @@ import type { I18n, I18nOptions } from 'vue-i18n' ...@@ -3,6 +3,7 @@ import type { I18n, I18nOptions } from 'vue-i18n'
import { createI18n } from 'vue-i18n' import { createI18n } from 'vue-i18n'
import langs from './lang' import langs from './lang'
// eslint-disable-next-line import/no-mutable-exports
export let i18n: ReturnType<typeof createI18n> export let i18n: ReturnType<typeof createI18n>
function createI18nOptions(): I18nOptions { function createI18nOptions(): I18nOptions {
......
...@@ -6,7 +6,7 @@ import { setupAppConfig } from '/@/config/app' ...@@ -6,7 +6,7 @@ import { setupAppConfig } from '/@/config/app'
import { setupStore } from '/@/store' import { setupStore } from '/@/store'
import { setupI18n } from '/@/locales' import { setupI18n } from '/@/locales'
import fuiConfig from './components/firstui/fui-config' import fuiConfig from './components/FirstUI/fui-config'
import 'uno.css' import 'uno.css'
...@@ -22,8 +22,8 @@ export function createApp() { ...@@ -22,8 +22,8 @@ export function createApp() {
// 配置 i18n // 配置 i18n
setupI18n(app) setupI18n(app)
//全局组件配置 // 全局组件配置
// @ts-ignore // @ts-expect-error
uni.$fui = fuiConfig uni.$fui = fuiConfig
return { return {
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
"autoscan": true, "autoscan": true,
"custom": { "custom": {
// https://doc.firstui.cn/docs/introduce.html // https://doc.firstui.cn/docs/introduce.html
"^fui-(.*)": "@/components/firstui/fui-$1/fui-$1.vue", "^fui-(.*)": "@/components/FirstUI/fui-$1/fui-$1.vue",
// https://ext.dcloud.net.cn/plugin?id=55#detail // https://ext.dcloud.net.cn/plugin?id=55#detail
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue" "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
} }
......
<script>
export default {
data() {
return {
resUrl: this.fui.resUrl(),
}
},
methods: {
goIndex() {
this.fui.href('/pages/tabbar/index/index', true)
},
},
}
</script>
<template> <template>
<view class="fui-wrap"> <view class="fui-wrap">
<view class="fui-content__box"> <view class="fui-content__box">
...@@ -23,21 +38,6 @@ ...@@ -23,21 +38,6 @@
</view> </view>
</template> </template>
<script>
export default {
data() {
return {
resUrl: this.fui.resUrl(),
}
},
methods: {
goIndex() {
this.fui.href('/pages/tabbar/index/index', true)
},
},
}
</script>
<style> <style>
page { page {
background-color: #fff; background-color: #fff;
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
onLoad(({ uri }) => { onLoad(({ uri }) => {
link.value = getExtranetUrl(uri) link.value = getExtranetUrl(uri)
name.value = URI(uri).filename() name.value = URI(uri).filename()
console.log(uri, link.value, name.value)
// 设置标题栏为文件名 // 设置标题栏为文件名
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
......
import type { AxiosRequestConfig, AxiosInstance, AxiosResponse, AxiosPromise, AxiosError } from 'axios' import type { AxiosError, AxiosInstance, AxiosPromise, AxiosRequestConfig, AxiosResponse } from 'axios'
import type { RequestOptions, Result, UploadFileParams } from '/#/axios' import type { RequestOptions, Result, UploadFileParams } from '/#/axios'
import type { CreateAxiosOptions } from './axiosTransform' import type { CreateAxiosOptions } from './axiosTransform'
import axios from 'axios' import axios from 'axios'
...@@ -7,8 +7,7 @@ import qs from 'qs' ...@@ -7,8 +7,7 @@ import qs from 'qs'
import { AxiosCanceler } from './axiosCancel' import { AxiosCanceler } from './axiosCancel'
import { isFunction } from '/@/utils/is' import { isFunction } from '/@/utils/is'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import { ContentTypeEnum } from '/@/enums/httpEnum' import { ContentTypeEnum, RequestEnum } from '/@/enums/httpEnum'
import { RequestEnum } from '/@/enums/httpEnum'
/** /**
* 覆盖实现,使用 uni.request 实现网络请求 * 覆盖实现,使用 uni.request 实现网络请求
...@@ -35,7 +34,7 @@ axios.defaults.adapter = function (config: CreateAxiosOptions): AxiosPromise<any ...@@ -35,7 +34,7 @@ axios.defaults.adapter = function (config: CreateAxiosOptions): AxiosPromise<any
}) })
}, },
fail: (response) => { fail: (response) => {
// @ts-ignore // @ts-expect-error
const { errMsg, statusCode } = response const { errMsg, statusCode } = response
const error = createError(errMsg, config, statusCode, request, { const error = createError(errMsg, config, statusCode, request, {
config, config,
...@@ -117,7 +116,7 @@ export class VAxios { ...@@ -117,7 +116,7 @@ export class VAxios {
// Request interceptor configuration processing // Request interceptor configuration processing
this.axiosInstance.interceptors.request.use((config: AxiosRequestConfig) => { this.axiosInstance.interceptors.request.use((config: AxiosRequestConfig) => {
// If cancel repeat request is turned on, then cancel repeat request is prohibited // If cancel repeat request is turned on, then cancel repeat request is prohibited
// @ts-ignore // @ts-expect-error
const { ignoreCancelToken } = config.requestOptions const { ignoreCancelToken } = config.requestOptions
const ignoreCancel = const ignoreCancel =
ignoreCancelToken !== undefined ? ignoreCancelToken : this.options.requestOptions?.ignoreCancelToken ignoreCancelToken !== undefined ? ignoreCancelToken : this.options.requestOptions?.ignoreCancelToken
...@@ -147,7 +146,7 @@ export class VAxios { ...@@ -147,7 +146,7 @@ export class VAxios {
responseInterceptorsCatch && responseInterceptorsCatch &&
isFunction(responseInterceptorsCatch) && isFunction(responseInterceptorsCatch) &&
this.axiosInstance.interceptors.response.use(undefined, (error) => { this.axiosInstance.interceptors.response.use(undefined, (error) => {
// @ts-ignore // @ts-expect-error
responseInterceptorsCatch(this.axiosInstance, error) responseInterceptorsCatch(this.axiosInstance, error)
}) })
} }
...@@ -191,7 +190,6 @@ export class VAxios { ...@@ -191,7 +190,6 @@ export class VAxios {
data: formData, data: formData,
headers: { headers: {
'Content-Type': ContentTypeEnum.FORM_DATA, 'Content-Type': ContentTypeEnum.FORM_DATA,
// @ts-ignore
ignoreCancelToken: true, ignoreCancelToken: true,
}, },
}) })
......
import { AxiosError, AxiosInstance } from 'axios' import type { AxiosError, AxiosInstance } from 'axios'
/** /**
* 请求重试机制 * 请求重试机制
*/ */
...@@ -9,15 +9,15 @@ export class AxiosRetry { ...@@ -9,15 +9,15 @@ export class AxiosRetry {
*/ */
retry(AxiosInstance: AxiosInstance, error: AxiosError) { retry(AxiosInstance: AxiosInstance, error: AxiosError) {
const { config } = error.response const { config } = error.response
// @ts-ignore // @ts-expect-error
const { waitTime, count } = config?.requestOptions?.retryRequest const { waitTime, count } = config?.requestOptions?.retryRequest
// @ts-ignore // @ts-expect-error
config.__retryCount = config.__retryCount || 0 config.__retryCount = config.__retryCount || 0
// @ts-ignore // @ts-expect-error
if (config.__retryCount >= count) { if (config.__retryCount >= count) {
return Promise.reject(error) return Promise.reject(error)
} }
// @ts-ignore // @ts-expect-error
config.__retryCount += 1 config.__retryCount += 1
return this.delay(waitTime).then(() => AxiosInstance(config)) return this.delay(waitTime).then(() => AxiosInstance(config))
} }
......
...@@ -10,11 +10,11 @@ import { checkStatus } from './checkStatus' ...@@ -10,11 +10,11 @@ import { checkStatus } from './checkStatus'
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import { useI18n } from '/@/hooks/app/useI18n' import { useI18n } from '/@/hooks/app/useI18n'
import { useMessage } from '/@/hooks/app/useMessage' import { useMessage } from '/@/hooks/app/useMessage'
import { RequestEnum, ContentTypeEnum } from '/@/enums/httpEnum' import { ContentTypeEnum, RequestEnum } from '/@/enums/httpEnum'
import { isString } from '/@/utils/is' import { isString } from '/@/utils/is'
import { getToken, clearAuthCache } from '/@/utils/auth' import { clearAuthCache, getToken } from '/@/utils/auth'
import { setObjToUrlParams, deepMerge } from '/@/utils' import { deepMerge, setObjToUrlParams } from '/@/utils'
import { joinTimestamp, formatRequestDate } from './helper' import { formatRequestDate, joinTimestamp } from './helper'
import { AxiosRetry } from '/@/utils/http/axios/axiosRetry' import { AxiosRetry } from '/@/utils/http/axios/axiosRetry'
import * as HTTP from '/@/api/types' import * as HTTP from '/@/api/types'
import { API_URL, API_URL_PREFIX } from '/@/utils/net' import { API_URL, API_URL_PREFIX } from '/@/utils/net'
...@@ -112,7 +112,7 @@ const transform: AxiosTransform = { ...@@ -112,7 +112,7 @@ const transform: AxiosTransform = {
config.params = Object.assign(params || {}, joinTimestamp(joinTime, false)) config.params = Object.assign(params || {}, joinTimestamp(joinTime, false))
} else { } else {
// 兼容restful风格 // 兼容restful风格
config.url = config.url + params + `${joinTimestamp(joinTime, true)}` config.url = `${config.url + params}${joinTimestamp(joinTime, true)}`
config.params = undefined config.params = undefined
} }
} else { } else {
...@@ -172,7 +172,7 @@ const transform: AxiosTransform = { ...@@ -172,7 +172,7 @@ const transform: AxiosTransform = {
let errMessage = '' let errMessage = ''
try { try {
if (code === 'ECONNABORTED' && message.indexOf('timeout') !== -1) { if (code === 'ECONNABORTED' && message.includes('timeout')) {
errMessage = t('sys.api.apiTimeoutMessage') errMessage = t('sys.api.apiTimeoutMessage')
} }
if (err?.includes('Network Error')) { if (err?.includes('Network Error')) {
...@@ -198,7 +198,7 @@ const transform: AxiosTransform = { ...@@ -198,7 +198,7 @@ const transform: AxiosTransform = {
const { isOpenRetry } = config.requestOptions.retryRequest const { isOpenRetry } = config.requestOptions.retryRequest
config.method?.toUpperCase() === RequestEnum.GET && config.method?.toUpperCase() === RequestEnum.GET &&
isOpenRetry && isOpenRetry &&
// @ts-ignore // @ts-expect-error
retryRequest.retry(axiosInstance, error) retryRequest.retry(axiosInstance, error)
return Promise.reject(error) return Promise.reject(error)
}, },
...@@ -238,7 +238,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) { ...@@ -238,7 +238,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
// 接口地址 // 接口地址
apiUrl: globSetting.apiUrl, apiUrl: globSetting.apiUrl,
// 接口拼接地址 // 接口拼接地址
urlPrefix: urlPrefix, urlPrefix,
// 是否加入时间戳 // 是否加入时间戳
joinTime: true, joinTime: true,
// 忽略重复请求 // 忽略重复请求
......
...@@ -25,7 +25,7 @@ export function getPopupContainer(node?: HTMLElement): HTMLElement { ...@@ -25,7 +25,7 @@ export function getPopupContainer(node?: HTMLElement): HTMLElement {
export function setObjToUrlParams(baseUrl: string, obj: any): string { export function setObjToUrlParams(baseUrl: string, obj: any): string {
let parameters = '' let parameters = ''
for (const key in obj) { for (const key in obj) {
parameters += key + '=' + encodeURIComponent(obj[key]) + '&' parameters += `${key}=${encodeURIComponent(obj[key])}&`
} }
parameters = parameters.replace(/&$/, '') parameters = parameters.replace(/&$/, '')
return /\?$/.test(baseUrl) ? baseUrl + parameters : baseUrl.replace(/\/?$/, '?') + parameters return /\?$/.test(baseUrl) ? baseUrl + parameters : baseUrl.replace(/\/?$/, '?') + parameters
...@@ -43,7 +43,7 @@ export function deepMerge<T = any>(src: any = {}, target: any = {}): T { ...@@ -43,7 +43,7 @@ export function deepMerge<T = any>(src: any = {}, target: any = {}): T {
export function getDynamicProps<T, U>(props: T): Partial<U> { export function getDynamicProps<T, U>(props: T): Partial<U> {
const ret: Recordable = {} const ret: Recordable = {}
Object.keys(props).map((key) => { Object.keys(props).forEach((key) => {
ret[key] = unref((props as Recordable)[key]) ret[key] = unref((props as Recordable)[key])
}) })
......
/* eslint-disable import/no-mutable-exports */
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
const globSetting = useGlobSetting() const globSetting = useGlobSetting()
......
...@@ -2,7 +2,7 @@ export function setBadge(number = 0) { ...@@ -2,7 +2,7 @@ export function setBadge(number = 0) {
// #ifdef APP-PLUS // #ifdef APP-PLUS
// 清除消息角标 // 清除消息角标
plus.runtime.setBadgeNumber(number) plus.runtime.setBadgeNumber(number)
if (plus.os.name.toLowerCase() == 'ios') { if (plus.os.name.toLowerCase() === 'ios') {
// 导入个推原生类 // 导入个推原生类
const GeTuiSdk = plus.ios.importClass('GeTuiSdk') const GeTuiSdk = plus.ios.importClass('GeTuiSdk')
GeTuiSdk?.setBadge(number) GeTuiSdk?.setBadge(number)
......
import type { Client, Message, Frame } from 'stompjs' import type { Client, Frame, Message } from 'stompjs'
import Stomp from './uni-stomp' import Stomp from './uni-stomp'
import UniWebSocket from './uni-websocket' import UniWebSocket from './uni-websocket'
import { getToken } from '/@/utils/auth' import { getToken } from '/@/utils/auth'
...@@ -156,7 +156,7 @@ class StompInstance { ...@@ -156,7 +156,7 @@ class StompInstance {
// 订阅状态置false // 订阅状态置false
Object.keys(this.subscribes).forEach((key) => { Object.keys(this.subscribes).forEach((key) => {
this.subscribes[key]['subscribed'] = false this.subscribes[key].subscribed = false
}) })
// 连接 // 连接
...@@ -191,16 +191,15 @@ class StompInstance { ...@@ -191,16 +191,15 @@ class StompInstance {
* @param {Function} callback 回调 * @param {Function} callback 回调
*/ */
subscribe(destination: string, callback: (message: Message) => any) { subscribe(destination: string, callback: (message: Message) => any) {
if (this.subscribes[destination] && this.subscribes[destination]['subscribed']) { if (this.subscribes[destination] && this.subscribes[destination].subscribed) {
// 已订阅 // 已订阅
return
} else if (this.client && this.client.connected) { } else if (this.client && this.client.connected) {
// 已连接:调用订阅,缓存订阅信息 // 已连接:调用订阅,缓存订阅信息
const subscribe = this.client.subscribe(destination, (res) => callback(res)) const subscribe = this.client.subscribe(destination, (res) => callback(res))
this.subscribes[destination] = { callback: callback, subscribed: true, subscribe: subscribe } this.subscribes[destination] = { callback, subscribed: true, subscribe }
} else { } else {
// 未连接:缓存订阅信息 // 未连接:缓存订阅信息
this.subscribes[destination] = { callback: callback, subscribed: false } this.subscribes[destination] = { callback, subscribed: false }
} }
} }
......
/* eslint-disable eslint-comments/no-unlimited-disable */
/* eslint-disable */ /* eslint-disable */
// @ts-nocheck // @ts-nocheck
......
...@@ -129,7 +129,7 @@ class UniWebSocket { ...@@ -129,7 +129,7 @@ class UniWebSocket {
*/ */
send(data: string | ArrayBuffer) { send(data: string | ArrayBuffer) {
this.ws.send({ this.ws.send({
data: data, data,
}) })
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论