Skip to content

Commit

Permalink
fix: 优化Icon性能
Browse files Browse the repository at this point in the history
  • Loading branch information
ShanaMaid committed Nov 8, 2018
1 parent 7ad76ac commit 646dce1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export interface IIconState {
*/
export class Icon extends Component<IIconProps, IIconState> {
componentDidMount() {
// 不使用ionicons图标时不进行加载,提高性能
if (!this.props.type) {
return;
}
const id = 'yoshino-demand-load';
if (document.getElementById(id)) {
return;
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/components/Modal/demo/modalDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Modal, Icon, Button } from '@yoshino/components/';
export default function() {
const confirm = () => {
Modal.confirm({
icon: <Icon type='checkmark-round'/>,
icon: <Icon type='md-checkmark'/>,
title: '这是一个标题!!!',
content: '这是一个内容主题!这是一个内容主题!这是一个内容主题!这是一个内容主题!!',
width: 400,
Expand Down

0 comments on commit 646dce1

Please sign in to comment.