Vue directives syntax resembling an object

Viewed 49

I encountered a weird syntax in a text on Vue and I don't know whether I missed some JS update on syntax from ES* or there's magic from Vue happening.

The question is, why and how, does this syntax work, without actually being a function but is more reminiscent of an object than a function?

EDIT: Thanks everybody for the quick replies, although this responses kinda answer I also wanted to know what happens, I mean: "bind" is already in the function's block, enclosing the following statements in an additional block, so if this were just a label, control would fall through like it were not there altogether. Or am I wrong?

 new Vue({
        el: "#app",
        data(){
            return {
                welcome: "Hello world"
            }
        },
        directives: {
            styleMe(el, binding, vnode, oldVnode) {
                bind: {
                    el.style.color = "blue";
                    el.style.fontSize = "42px";
                    el.className = "text-center";
                    alert('done');
                }
            }
        }
0 Answers
Related