mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-14 05:03:49 +08:00
发布v2.2.10版本,更新内容请查看:https://github.com/bufanyun/hotgo/tree/v2.0/docs/guide-zh-CN/addon-version-upgrade.md
This commit is contained in:
17
web/src/utils/icons.ts
Normal file
17
web/src/utils/icons.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Component } from 'vue';
|
||||
import { renderIcon } from '@/utils/index';
|
||||
import * as antdIcons from '@vicons/antd';
|
||||
// import * as x5Icons from '@vicons/ionicons5';
|
||||
|
||||
export const Icons = {};
|
||||
for (const element of Object.keys(antdIcons)) {
|
||||
Icons[element] = renderIcon(antdIcons[element]);
|
||||
}
|
||||
|
||||
// for (const element of Object.keys(x5Icons)) {
|
||||
// constantRouterIcon[element] = renderIcon(x5Icons[element]);
|
||||
// }
|
||||
|
||||
export function getIconComponent(name: string): Component {
|
||||
return Icons[name];
|
||||
}
|
||||
@@ -15,8 +15,8 @@ export const renderTooltip = (trigger, content) => {
|
||||
/**
|
||||
* render 图标
|
||||
* */
|
||||
export function renderIcon(icon) {
|
||||
return () => h(NIcon, null, { default: () => h(icon) });
|
||||
export function renderIcon(icon, props = null) {
|
||||
return () => h(NIcon, props, { default: () => h(icon) });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -138,3 +138,7 @@ export function isNullOrUnDef(val: unknown): val is null | undefined {
|
||||
export function isLetterBegin(str) {
|
||||
return /^[A-z]/.test(str);
|
||||
}
|
||||
|
||||
export function isUrl(url: string): boolean {
|
||||
return /(^http|https:\/\/)/g.test(url);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { SocketEnum } from '@/enums/socketEnum';
|
||||
import { notificationStoreWidthOut } from '@/store/modules/notification';
|
||||
import { useUserStoreWidthOut } from '@/store/modules/user';
|
||||
import { TABS_ROUTES } from '@/store/mutation-types';
|
||||
import { MessageRow } from '@/enums/systemMessageEnum';
|
||||
import { isJsonString } from '@/utils/is';
|
||||
|
||||
let socket: WebSocket;
|
||||
@@ -103,7 +102,7 @@ export default (onMessage: Function) => {
|
||||
if (useUserStore.token === '') {
|
||||
throw new Error('用户未登录,稍后重试...');
|
||||
}
|
||||
socket = new WebSocket(useUserStore.config.wsAddr + '?authorization=' + useUserStore.token);
|
||||
socket = new WebSocket(useUserStore.config?.wsAddr + '?authorization=' + useUserStore.token);
|
||||
init();
|
||||
} catch (e) {
|
||||
console.log('createSocket err:' + e);
|
||||
|
||||
Reference in New Issue
Block a user