-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(back-top): dom结构对齐小程序端 * feat(back-top): api功能对齐mobile vue * feat(back-top): 官网示例代码&&演示示例对齐新视觉稿 * feat(back-top): 用tsx写demo * feat(back-top): dom结构对齐小程序端 * feat(back-top): api功能对齐mobile vue * feat(back-top): 官网示例代码&&演示示例对齐新视觉稿 * feat(back-top): 用tsx写demo * test: update csr and ssr snap * chore: update _common * test: update csr snap --------- Co-authored-by: anlyyao <[email protected]> Co-authored-by: 黎伟杰 <[email protected]>
- Loading branch information
1 parent
c873dc4
commit fcd05b7
Showing
15 changed files
with
424 additions
and
115 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
Submodule _common
updated
21 files
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React, { useState, useCallback } from 'react'; | ||
import { BackTop, Button } from 'tdesign-mobile-react'; | ||
import './style/index.less'; | ||
|
||
export default function Base({ visible, onClose, container }) { | ||
const [theme, setTheme] = useState({ | ||
theme: 'round', | ||
text: '顶部', | ||
}); | ||
|
||
// 切换主题 | ||
const onClick = useCallback( | ||
(theme, text) => { | ||
setTheme({ | ||
theme, | ||
text, | ||
}); | ||
onClose(); | ||
const containerElement = container(); | ||
containerElement.scrollTop = 1200; | ||
}, | ||
[onClose, container], | ||
); | ||
|
||
function handleToTop() { | ||
console.log('handleToTop'); | ||
} | ||
|
||
return ( | ||
<> | ||
{visible ? <BackTop text={theme.text} theme={theme.theme} onToTop={handleToTop} container={container} /> : null} | ||
<div className="button-group"> | ||
<Button className="button" variant="outline" theme="primary" onClick={() => onClick('round', '顶部')}> | ||
圆形返回顶部 | ||
</Button> | ||
<Button className="button" variant="outline" theme="primary" onClick={() => onClick('half-round', '返回顶部')}> | ||
半圆形返回顶部 | ||
</Button> | ||
</div> | ||
</> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,5 +1,7 @@ | ||
.tdesign-mobile-react-demo { | ||
background: #fff; | ||
overflow: auto; | ||
height: 100vh; | ||
|
||
.button-group { | ||
display: flex; | ||
|
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,19 @@ | ||
:: BASE_DOC :: | ||
|
||
## API | ||
|
||
|
||
### BackTop Props | ||
|
||
name | type | default | description | required | ||
-- | -- | -- | -- | -- | ||
className | String | - | className of component | N | ||
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N | ||
container | Function | - | Typescript:`() => HTMLElement` | N | ||
fixed | Boolean | true | \- | N | ||
icon | TNode | true | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N | ||
target | Function | - | Typescript:`() => HTMLElement` | N | ||
text | String | '' | \- | N | ||
theme | String | round | options: round/half-round/round-dark/half-round-dark | N | ||
visibilityHeight | Number | 200 | \- | N | ||
onToTop | Function | | Typescript:`() => void`<br/> | N |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC | ||
* */ | ||
|
||
import { TdBackTopProps } from './type'; | ||
|
||
export const backTopDefaultProps: TdBackTopProps = { | ||
fixed: true, | ||
icon: true, | ||
text: '', | ||
theme: 'round', | ||
visibilityHeight: 200, | ||
}; |
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 +1 @@ | ||
import '../../_common/style/mobile/components/back-top/_index.less'; | ||
import '../../_common/style/mobile/components/back-top/v2/_index.less'; |
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
Oops, something went wrong.