DEV Community

Peng Lee
Peng Lee

Posted on

I cannot understand following vue code.

When I read the Apache Dolphinscheduler Frontend code, which is written by Vue3, I find a code fragment very confusing me. So I post this for help.
Image description

Top comments (2)

Collapse
 
williamfernandes252 profile image
William Fernandes Dias

It's defining a watcher to a reactive state with the composition API. In the first argument was passed a getter to the value to be watched, wich in this case is a ref value (could've used just the ref itself, but in this case the watch would be deep) and in the second was passed the function to be executed whenever this value changes.

Collapse
 
vivostar profile image
Peng Lee

thanks your reply. I get it. Thanks