CommanderRoot
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
6 additions and
6 deletions
-
components/_util/getDataOrAriaProps.ts
-
components/tree/demo/search.md
-
components/upload/demo/file-type.md
-
site/theme/template/Layout/Header/index.tsx
|
|
@ -1,8 +1,8 @@ |
|
|
|
export default function getDataOrAriaProps(props: any) { |
|
|
|
return Object.keys(props).reduce((prev: any, key: string) => { |
|
|
|
if ( |
|
|
|
(key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') && |
|
|
|
key.substr(0, 7) !== 'data-__' |
|
|
|
(key.startsWith('data-') || key.startsWith('aria-') || key === 'role') && |
|
|
|
!key.startsWith('data-__') |
|
|
|
) { |
|
|
|
prev[key] = props[key]; |
|
|
|
} |
|
|
|
|
|
@ -110,8 +110,8 @@ class SearchTree extends React.Component { |
|
|
|
const loop = data => |
|
|
|
data.map(item => { |
|
|
|
const index = item.title.indexOf(searchValue); |
|
|
|
const beforeStr = item.title.substr(0, index); |
|
|
|
const afterStr = item.title.substr(index + searchValue.length); |
|
|
|
const beforeStr = item.title.substring(0, index); |
|
|
|
const afterStr = item.title.slice(index + searchValue.length); |
|
|
|
const title = |
|
|
|
index > -1 ? ( |
|
|
|
<span> |
|
|
|
|
|
@ -102,7 +102,7 @@ class PicturesWall extends React.Component { |
|
|
|
icon = <LoadingOutlined />; // or icon = 'uploading...'; |
|
|
|
} else { |
|
|
|
fileSufIconList.forEach(item => { |
|
|
|
if (item.suf.includes(file.name.substr(file.name.lastIndexOf('.')))) { |
|
|
|
if (item.suf.includes(file.name.slice(file.name.lastIndexOf('.')))) { |
|
|
|
icon = item.type; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
@ -192,7 +192,7 @@ class Header extends React.Component<HeaderProps, HeaderState> { |
|
|
|
location: { pathname, query }, |
|
|
|
} = this.props; |
|
|
|
const currentProtocol = `${window.location.protocol}//`; |
|
|
|
const currentHref = window.location.href.substr(currentProtocol.length); |
|
|
|
const currentHref = window.location.href.slice(currentProtocol.length); |
|
|
|
|
|
|
|
if (utils.isLocalStorageNameSupported()) { |
|
|
|
localStorage.setItem('locale', utils.isZhCN(pathname) ? 'en-US' : 'zh-CN'); |
|
|
|