Skip to content

Commit

Permalink
fix: basic增加 custom.d.ts 处理svg引用ts类型报错
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenlingasMx committed Jun 9, 2023
1 parent 0871807 commit eef231e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/antdp-base/config/router.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
{
"path": "/dashboard",
"name": "页面试例",
"name": "页面实例",
"locale": "dashboard",
"icon": "fileText",
"side": true,
Expand Down
4 changes: 2 additions & 2 deletions examples/antdp-base/src/layouts/BasicLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { useState } from 'react';
import { FloatButton } from 'antd';
import Authorized from '@antdp/authorized';
import BasicLayout from '@antdp/basic-layouts';
import BasicLayouts from '@antdp/basic-layouts';
import {
SelectLang,
useIntl,
Expand Down Expand Up @@ -41,7 +41,7 @@ const Layout = () => {
onClick={() => setDark(!dark)}
/>
</FloatButton.Group>
<BasicLayout
<BasicLayouts
theme={dark ? 'dark' : 'light'}
className="antdp-basic-layouts"
projectName="Ant Design"
Expand Down
2 changes: 1 addition & 1 deletion examples/antdp-base/src/locales/zh-CN/menu.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
'menu.welcome': '首页',
'menu.chart': '图表页',
'menu.dashboard': '页面试例',
'menu.dashboard': '页面实例',
'menu.components': '组件页',
'menu.components.quickform': '快速表单',
'menu.components.formdetail': '详情表单',
Expand Down
4 changes: 4 additions & 0 deletions examples/basic/custom.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const content: any;
export default content;
}
5 changes: 2 additions & 3 deletions examples/basic/src/layouts/BasicLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import {
UserOutlined,
} from '@ant-design/icons';
import Authorized from '@antdp/authorized';
import BasicLayout from '@antdp/basic-layouts';
import BasicLayouts from '@antdp/basic-layouts';
import 'antd/dist/reset.css';
import logo from './logo.svg';

const Layout = () => {
return (
<Authorized authority={true} redirectPath="/login">
<BasicLayout
<BasicLayouts
projectName="Ant Design"
profile={{
name: '埋名',
Expand Down
8 changes: 7 additions & 1 deletion script/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ const fieldMap = async () => {
if (item.ext && /ts|tsx/.test(item.ext)) {
transform(item.path);
} else {
FS.copySync(item.path, item.path.replace(PWDEntry, PWDOutPut));
const outPutPath = item.path.replace(PWDEntry, PWDOutPut);
// 删除 custom.d.ts 文件
if (outPutPath.endsWith('custom.d.ts')) {
fs.unlinkSync(outPutPath);
} else {
FS.copySync(item.path, outPutPath);
}
}
});
};
Expand Down

0 comments on commit eef231e

Please sign in to comment.