跳到主要内容
版本:v7

ion-ripple-effect

shadow

涟漪效果组件添加 Material Design 墨水涟漪交互效果。此组件只能在 <ion-app> 内部使用,并可以添加到任何元素内部。

重要的是在父元素上设置相对定位,因为涟漪效果是绝对定位的,将覆盖具有相对定位的最近父元素。父元素还应被赋予 ion-activatable 类,告诉涟漪效果该元素是可点击的。如果涟漪溢出其容器,建议向父元素添加 overflow: hidden

基本用法

类型

有两种类型的涟漪效果:"bounded""unbounded"。默认类型 "bounded" 会从点击位置向外扩展涟漪效果。要添加始终从元素中心开始并呈圆形扩展的涟漪效果,请将类型设置为 "unbounded"

自定义

涟漪可以通过 CSS 自定义为不同的颜色。默认情况下,涟漪颜色设置为继承文本颜色,通常是正文颜色。这可以通过在父元素或涟漪效果本身上设置 CSS color 来更改。

属性

type

说明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.
属性type
类型"bounded" | "unbounded"
默认值'bounded'

事件

该组件没有可用的事件。

方法

addRipple

说明Adds the ripple effect to the parent element.
签名addRipple(x: number, y: number) => Promise<() => void>
参数x: The horizontal coordinate of where the ripple should start.
y: The vertical coordinate of where the ripple should start.

CSS 阴影部分

该组件没有可用的 CSS 阴影部分。

CSS 自定义属性

该组件没有可用的 CSS 自定义属性。

插槽

该组件没有可用的插槽。