I use the ww-button template code from this Github:
And I added a setInterval, but after the 5 seconds. I want that it manually click on this button.
I tried this code, but it give me an error: this.$emit('trigger-event', { name: 'click' });
In the workflow I did place this as execute code: alert("hello clicked here")
And manually click do show this alert message.
Let me see if I understand correctly:
you want to click the button programmatically from the code inside your custom element, so that in weweb the workflow triggered by the click event will execute. Is this what you want to accomplish?
If it is then instead of clicking the button declare another event in your component and trigger it programmatically. Then in the editor you can create a global workflow and execute it on both the click event and your custom event
Let me see if I understand correctly:
you want to click the button programmatically from the code inside your custom element, so that in weweb the workflow triggered by the click event will execute. Is this what you want to accomplish?
Yes. We need a âin the boxâ solution (for our Elements). So that it only need a drag and drop, with no further adjustments in the weweb panel.
If you can build the workflow inside weweb, you can save the component as a UI kit, and be able to drag and drop the same component anywhere. Can you further help us understand specifically what exactly are you trying to achieve?
Yes, I can explain more about the Element I must build. I use the basic of the Github ww-button code, but with a custom CSS design. When this button is visible and created on a web page. The user can click on that button to execute that workflow event (for example alert(âhello clicked hereâ) or navigate to another web page). But if the user do not click on this button within the 10 seconds. It automatically count from 0 to 10. When it reach the count value 10, then it should execute this button action.
Currently, in my Element code is everything is working. Only I need that manually click action or call that workflow event.
put a variable clickedButton = true when button is clicked. Default is false.
on pageload, execute a workflow with time delay 10 secs, then check the variable value, if false execute the button action(which should be another workflow), if true then nothing happens.
I tried that idea const emit = this.$emit but for this. And now I use a new variable const that = this. And that.$refs.btnauto.click(); will execute now well this button.
Thank you for the suggestion!