-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lili.21
committed
Aug 1, 2023
1 parent
9085316
commit bafb698
Showing
3 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { Button, Drawer, Spin } from 'antd' | ||
import { Button, Empty } from 'antd' | ||
|
||
import { Divider, Tabs, TabPane } from '@douyinfe/semi-ui' | ||
|
||
function Test() { | ||
return ( | ||
<Spin spinning={loading}> | ||
<p>hello</p> | ||
</Spin> | ||
<Empty> | ||
<button>hello</button> | ||
</Empty> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const { removeAntdImportAndAddSemiImport } = require('./utils') | ||
|
||
module.exports = function (file, api) { | ||
const j = api.jscodeshift | ||
const root = j(file.source) | ||
|
||
removeAntdImportAndAddSemiImport(j, root, 'Empty', 'Empty') | ||
|
||
// Find all JSXElements with the name "Empty" | ||
const emptyElements = root.findJSXElements('Empty') | ||
|
||
// Modify each Empty element | ||
emptyElements.forEach((element) => { | ||
const { openingElement } = element.node | ||
|
||
const descriptionAttribute = openingElement.attributes.find( | ||
(attr) => attr.name.name === 'description' | ||
) | ||
|
||
if (!descriptionAttribute) { | ||
// Add the "description" attribute with the value "暂无数据" | ||
element.node.openingElement.attributes.push( | ||
j.jsxAttribute(j.jsxIdentifier('description'), j.literal('暂无数据')) | ||
) | ||
} | ||
}) | ||
|
||
return root.toSource() | ||
} |