diff --git a/package/component/src/component/ripple/index.less b/package/component/src/component/ripple/index.less new file mode 100644 index 00000000..e28ff39c --- /dev/null +++ b/package/component/src/component/ripple/index.less @@ -0,0 +1,73 @@ +.layui-water-ripples-container { + position: relative; + display: inline-block; + + .layui-slot-container { + position: relative; + z-index: 2; + } + + .layui-out-ripples { + position: absolute; + left: 0; + top: 0; + height: 100%; + opacity: 1; + z-index: 1; + pointer-events: none; + } + + .layui-animate-once--out { + animation: ripple-effect 1s forwards; + } + + .layui-animate-always--out { + animation: ripple-effect 1s infinite; + } + + @keyframes ripple-effect { + 0% { + box-shadow: 0 0 0 0px var(--layui-ripple-color); + opacity: 0.3; + } + + 100% { + box-shadow: 0 0 0 var(--layui-spread-width) var(--layui-ripple-color); + opacity: 0; + } + } + + .layui-inset-ripples { + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + opacity: 1; + width: 0px; + height: 0px; + background: var(--layui-ripple-color); + pointer-events: none; + } + + @keyframes size-effect { + 0% { + width: 0px; + height: 0px; + opacity: 0.8; + } + + 100% { + width: var(--layui-spread-size); + height: var(--layui-spread-size); + opacity: 0; + } + } + + .layui-animate-once--inset { + animation: size-effect 1s forwards; + } + + .layui-animate-always--inset { + animation: size-effect 1s infinite; + } +} \ No newline at end of file diff --git a/package/component/src/component/ripple/index.ts b/package/component/src/component/ripple/index.ts new file mode 100644 index 00000000..389b5c17 --- /dev/null +++ b/package/component/src/component/ripple/index.ts @@ -0,0 +1,8 @@ +import type { App } from "vue"; +import Component from "./index.vue"; + +Component.install = (app: App) => { + app.component(Component.name, Component); +}; + +export default Component; \ No newline at end of file diff --git a/package/component/src/component/ripple/index.vue b/package/component/src/component/ripple/index.vue new file mode 100644 index 00000000..f602a577 --- /dev/null +++ b/package/component/src/component/ripple/index.vue @@ -0,0 +1,115 @@ + + + + + \ No newline at end of file diff --git a/package/component/src/index.ts b/package/component/src/index.ts index 098e460d..7a20029e 100644 --- a/package/component/src/index.ts +++ b/package/component/src/index.ts @@ -82,6 +82,7 @@ import LayDatePicker from "./component/datePicker/index"; import LayNoticeBar from "./component/noticeBar/index"; import LayTransition from "./component/transition/index"; import LayUpload from "./component/upload/index"; +import LayRipple from "./component/ripple/index"; import LayConfigProvider from "./provider"; import { InstallOptions } from "./types"; @@ -162,6 +163,7 @@ const components: Record = { LayNoticeBar, LayTransition, LayUpload, + LayRipple, }; const install = (app: App, options?: InstallOptions): void => { @@ -250,6 +252,7 @@ export { LayNoticeBar, LayTransition, LayUpload, + LayRipple, install, }; diff --git a/package/document/src/document/zh-CN/components/ripple.md b/package/document/src/document/zh-CN/components/ripple.md new file mode 100644 index 00000000..d2640935 --- /dev/null +++ b/package/document/src/document/zh-CN/components/ripple.md @@ -0,0 +1,48 @@ +::: anchor +::: + +::: title 基本介绍 +::: + +::: describe 为组件添加水波纹动画。 +::: + +::: title 测试 +::: + +::: demo 使用 `lay-ripple` 标签, 添加水波纹 + + + + + +::: \ No newline at end of file diff --git a/package/document/src/router/zh-CN.ts b/package/document/src/router/zh-CN.ts index ad8e6d4a..6d1e2bea 100644 --- a/package/document/src/router/zh-CN.ts +++ b/package/document/src/router/zh-CN.ts @@ -381,7 +381,13 @@ const zhCN = [ path: "/zh-CN/components/transition", component: () => import("../document/zh-CN/components/transition.md"), - meta: { title: "通知栏" }, + meta: { title: "过渡" }, + }, + { + path: "/zh-CN/components/ripple", + component: () => + import("../document/zh-CN/components/ripple.md"), + meta: { title: "水波纹" }, }, ], }, diff --git a/package/document/src/view/utils/menus.ts b/package/document/src/view/utils/menus.ts index a0edb6bd..98636c87 100644 --- a/package/document/src/view/utils/menus.ts +++ b/package/document/src/view/utils/menus.ts @@ -34,11 +34,17 @@ const menus = [ path: "/zh-CN/components/transition", }, { - id: 101, + id: 102, title: "全屏", subTitle: "fullscreen", path: "/zh-CN/components/fullscreen", }, + { + id: 103, + title: "水波纹", + subTitle: "ripple", + path: "/zh-CN/components/ripple", + }, ], }, {