Skip to content

Commit

Permalink
fix: 优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
JackySoft authored and jianbing.chen committed Dec 18, 2024
1 parent 3a1101e commit 39758fa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packages/editor/src/api/lib.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import request from '@/utils/request';

// 获取安装组件列表
export const getInstallList = () => {
return request.post<any[]>('/lib/install/list', {}, { showLoading: false });
};
2 changes: 1 addition & 1 deletion packages/editor/src/config/icons/IconTinyLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const IconTinyLine = (props: any) => {
<svg width={width} height={height} viewBox="0 0 72 58" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient x1="55.9218354%" y1="100%" x2="55.9218354%" y2="34.8285281%" id="linearGradient-1">
<stop stop-color="#FFFFFF" stop-opacity="0" offset="0%"></stop>
<stop stop-color="#FFFFFF" stopOpacity="0" offset="0%"></stop>
<stop stop-color="#E4E7FF" offset="100%"></stop>
</linearGradient>
</defs>
Expand Down
6 changes: 3 additions & 3 deletions packages/editor/src/layout/components/Menu/CustomLib.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getInstallList, ILibPublish } from '@/api/lib';
import { getInstallList } from '@/api/lib';
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
import { usePageStore } from '@/stores/pageStore';
import { Button, Flex, Spin } from 'antd';
Expand All @@ -9,7 +9,7 @@ import { createId } from '@/utils/util';

function CustomLib(_: any, ref: any) {
const [loading, setLoading] = useState(false);
const [list, setList] = useState<ILibPublish[]>([]);
const [list, setList] = useState<any[]>([]);
const { selectedElement, addElement, addChildElements } = usePageStore((state) => {
return {
addElement: state.addElement,
Expand Down Expand Up @@ -48,7 +48,7 @@ function CustomLib(_: any, ref: any) {
}
};

const handleClick = async (item: ILibPublish) => {
const handleClick = async (item: any) => {
// 生成默认配置
const { config, events, methods = [] }: any = await loadModule(item.configUrl);
const newId = createId(item.tag);
Expand Down

0 comments on commit 39758fa

Please sign in to comment.