mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-02 03:57:38 +08:00
fix(module: affix): code cleaning, doc update (#805)
Co-authored-by: Lars Diederich <diederich@evodata.de>
This commit is contained in:
parent
456c0819ba
commit
4a1caf6c40
@ -1,17 +1,6 @@
|
||||
@namespace AntDesign
|
||||
@inherits AntDomComponentBase
|
||||
<!--affixed-->
|
||||
@*<div @ref="_ref">
|
||||
<div aria-hidden="true" style="width: 618.3px; height: 32px;">
|
||||
</div>
|
||||
<div class="ant-affix" style="top: 120px; width: 618.3px; height: 32px; position: fixed;">
|
||||
<button class="ant-btn" type="button">
|
||||
<span>120px to affix top</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>*@
|
||||
|
||||
<!--not affixed-->
|
||||
<div @ref="_ref">
|
||||
@if (_affixed)
|
||||
{
|
||||
|
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using AntDesign.JsInterop;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@ -15,7 +11,6 @@ namespace AntDesign
|
||||
private const string RootScollSelector = "window";
|
||||
private const string RootRectSelector = "app";
|
||||
private bool _affixed;
|
||||
private bool _rendered;
|
||||
private bool _rootListened;
|
||||
private bool _targetListened;
|
||||
|
||||
@ -96,7 +91,6 @@ namespace AntDesign
|
||||
protected async override Task OnFirstAfterRenderAsync()
|
||||
{
|
||||
await base.OnFirstAfterRenderAsync();
|
||||
_rendered = true;
|
||||
|
||||
DomRect domRect = await JsInvokeAsync<DomRect>(JSInteropConstants.GetBoundingClientRect, _childRef);
|
||||
_hiddenStyle = $"width: {domRect.width}px; height: {domRect.height}px;";
|
||||
|
@ -19,9 +19,9 @@ Wrap Affix around another component to make it stick the viewport.
|
||||
|
||||
| Property | Description | Type | Default Value |
|
||||
| --- | --- | --- | --- |
|
||||
| OffsetBottom | Offset from the bottom of the viewport (in pixels) | int | - |
|
||||
| OffsetTop | Offset from the top of the viewport (in pixels)| int |- |
|
||||
| OffsetBottom | Offset from the bottom of the viewport (in pixels) | uint? | - |
|
||||
| OffsetTop | Offset from the top of the viewport (in pixels)| uint? | 0 |
|
||||
| Target | Specifies the scrollable area DOM node | RenderFragment |- |
|
||||
| OnChange |Callback for when Affix state is changed| Function() | - |
|
||||
| OnChange |Callback for when Affix state is changed| EventCallback<bool> | - |
|
||||
|
||||
Note: Children of `Affix` must not have the property `position: absolute`, but you can set `position: absolute` on `Affix` itself:
|
||||
|
@ -20,10 +20,10 @@ cover: https://gw.alipayobjects.com/zos/alicdn/tX6-md4H6/Affix.svg
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| ---------------- | -------------------------------------------- | ------------- | --------- |
|
||||
| OffsetBottom | 距离窗口底部达到指定偏移量后触发 | int | - |
|
||||
| OffsetTop | 距离窗口顶部达到指定偏移量后触发| int |- |
|
||||
| OffsetBottom | 距离窗口底部达到指定偏移量后触发 | uint? | - |
|
||||
| OffsetTop | 距离窗口顶部达到指定偏移量后触发| uint? | 0 |
|
||||
| Target | 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 | RenderFragment |- |
|
||||
| OnChange | 固定状态改变时触发的回调函数| Function() | - |
|
||||
| OnChange | 固定状态改变时触发的回调函数| EventCallback<bool> | - |
|
||||
|
||||
注意:`Affix` 内的元素不要使用绝对定位,如需要绝对定位的效果,可以直接设置 `Affix` 为绝对定位:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user