Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbeccb4d

Browse files
Merge pull request#2066 from iamfaran/feat/2063-click-lotte
[Feat]: add click/double click events for lotte
2 parents21464bd +e0ddfb8 commitbeccb4d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

‎client/packages/lowcoder/src/comps/comps/jsonComp/jsonLottieComp.tsx‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { styleControl } from "comps/controls/styleControl";
1010
import{AnimationStyle,LottieStyle}from"comps/controls/styleControlConstants";
1111
import{trans}from"i18n";
1212
import{Section,sectionNames}from"lowcoder-design";
13-
import{useContext,lazy,useEffect,useState}from"react";
13+
import{useContext,lazy,useEffect,useState,useCallback}from"react";
1414
import{stateComp,UICompBuilder,withDefault}from"../../generators";
1515
import{
1616
NameConfig,
@@ -23,9 +23,10 @@ import { AssetType, IconscoutControl } from "@lowcoder-ee/comps/controls/iconsco
2323
import{DotLottie}from"@lottiefiles/dotlottie-react";
2424
import{AutoHeightControl}from"@lowcoder-ee/comps/controls/autoHeightControl";
2525
import{useResizeDetector}from"react-resize-detector";
26-
import{eventHandlerControl}from"@lowcoder-ee/comps/controls/eventHandlerControl";
26+
import{eventHandlerControl,clickEvent,doubleClickEvent}from"@lowcoder-ee/comps/controls/eventHandlerControl";
2727
import{withMethodExposing}from"@lowcoder-ee/comps/generators/withMethodExposing";
2828
import{changeChildAction}from"lowcoder-core";
29+
import{useCompClickEventHandler}from"@lowcoder-ee/comps/utils/useCompClickEventHandler";
2930

3031
// const Player = lazy(
3132
// () => import('@lottiefiles/react-lottie-player')
@@ -128,6 +129,8 @@ const ModeOptions = [
128129
]asconst;
129130

130131
constEventOptions=[
132+
clickEvent,
133+
doubleClickEvent,
131134
{label:trans("jsonLottie.load"),value:"load",description:trans("jsonLottie.load")},
132135
{label:trans("jsonLottie.play"),value:"play",description:trans("jsonLottie.play")},
133136
{label:trans("jsonLottie.pause"),value:"pause",description:trans("jsonLottie.pause")},
@@ -160,6 +163,10 @@ let JsonLottieTmpComp = (function () {
160163
};
161164
returnnewUICompBuilder(childrenMap,(props,dispatch)=>{
162165
const[dotLottie,setDotLottie]=useState<DotLottie|null>(null);
166+
consthandleClickEvent=useCompClickEventHandler({onEvent:props.onEvent});
167+
consthandleClick=useCallback(()=>{
168+
handleClickEvent();
169+
},[handleClickEvent]);
163170

164171
constsetLayoutAndResize=()=>{
165172
constalign=props.align.split(',');
@@ -244,6 +251,7 @@ let JsonLottieTmpComp = (function () {
244251
padding:`${props.container.padding}`,
245252
rotate:props.container.rotation,
246253
}}
254+
onClick={handleClick}
247255
>
248256
<DotLottiePlayer
249257
key={

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp