This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Showing
5 changed files
with
161 additions
and
10 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@page "/components/affix" | ||
<PageHeader Title="Affix 固钉"> | ||
在指定的范围内,将元素固定不动。 | ||
</PageHeader> | ||
<HighlightAlert /> | ||
<Example Title="基础固钉"> | ||
<Description>@Code.Create("适用于页面结构简单的场景,默认容器是 `body`。")</Description> | ||
<RunContent> | ||
<div id="div-box" style="overflow-y:auto;height:200px;"> | ||
<p>内容</p> | ||
<TAffix Container="div-box" OffsetTop="50"> | ||
<TButton>按 钮</TButton> | ||
</TAffix> | ||
<p>内容</p> | ||
<p>内容</p> | ||
<p>内容</p> | ||
<p>内容</p> | ||
<p>内容</p> | ||
<p>内容</p> | ||
<p>内容</p> | ||
<p>内容</p> | ||
<p>内容</p> | ||
<p>内容</p> | ||
<p>内容</p> | ||
<p>内容</p><p>内容</p> | ||
<p>内容</p><p>内容</p> | ||
<p>内容</p> | ||
|
||
|
||
</div> | ||
</RunContent> | ||
</Example> |
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
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,26 @@ | ||
| ||
/** | ||
* @description 组件 affix 用到的js对象。 | ||
*/ | ||
let affix = { | ||
/** | ||
* 组件初始化方法,用于给指定的元素绑定onscroll事件。 | ||
* @function affix.init | ||
* @param {String} id HTML元素id,如果为空则使用document.body | ||
*/ | ||
init: function (id, dotnetRef) { | ||
console.log('[info] affix.init ', id) | ||
let el = id ? document.getElementById(id) : document.body | ||
el.onscroll = function () { | ||
let top = el.scrollTop | ||
let height = el.scrollHeight | ||
let bottom = height - top - el.clientHeight | ||
dotnetRef.invokeMethodAsync("OnScrollChanged", top, bottom, height) | ||
} | ||
|
||
}, | ||
show: function(top, bottom, height){ | ||
console.log(`[info]affix.box top:${top}, bottom:${bottom}, height:${height}`) | ||
}, | ||
} | ||
|
||
export { affix } |