ion-ripple-effect
水波纹效果组件添加了 Material Design 墨水涟漪交互效果。此组件只能在 <ion-app> 内部使用,并可以添加到任何元素中。
在父元素上设置 相对定位 非常重要,因为水波纹效果采用绝对定位,并将覆盖其最近的具有相对定位的父元素。父元素还应添加 ion-activatable 类,这告诉水波纹效果该元素是可点击的。如果水波纹溢出其容器,建议在父元素上添加 overflow: hidden。
基本用法
类型
水波纹效果有两种类型:"bounded" 和 "unbounded"。默认类型 "bounded" 会从点击位置向外扩展水波纹效果。要添加始终从元素中心开始并以圆形扩展的水波纹效果,请将类型设置为 "unbounded"。
自定义
可以通过 CSS 将水波纹自定义为不同的颜色。默认情况下,水波纹颜色设置为继承文本颜色,通常是主体颜色。可以通过在父元素或水波纹效果本身上设置 CSS color 属性来更改此颜色。
属性
type
| Description | Sets the type of ripple-effect: - bounded: the ripple effect expands from the user's click position - unbounded: the ripple effect expands from the center of the button and overflows the container.NOTE: Surfaces for bounded ripples should have the overflow property set to hidden, while surfaces for unbounded ripples should have it set to visible. |
| Attribute | type |
| Type | "bounded" | "unbounded" |
| Default | 'bounded' |
事件
No events available for this component.
方法
addRipple
| Description | Adds the ripple effect to the parent element. |
| Signature | addRipple(x: number, y: number) => Promise<() => void> |
| Parameters | x: The horizontal coordinate of where the ripple should start. y: The vertical coordinate of where the ripple should start. |
CSS Shadow Parts
No CSS shadow parts available for this component.
CSS 自定义属性
No CSS custom properties available for this component.
插槽
No slots available for this component.