Home > front end >  The use of the js in parentheses (), for advice
The use of the js in parentheses (), for advice

Time:12-06

 render (h) {
Const component=(
    Role="menubar
    "Key={+ enclosing the collapse}
    Style={{backgroundColor: enclosing backgroundColor | | '}}
    Class={{
    'el - menu -- horizontal' : this mode==='horizontal',
    'el - menu - the collapse: enclosing the collapse,
    "El - menu" : true
    }}

    {this. $slots. The default}

);

If (this. CollapseTransition) {
Return (

{component}

);
} else {
Return component;
}
}


Boring to see the next elementUI source, found that a previously unknown parentheses () grammar, such as the above
Component=(* * * *)
Have a little meng this is the string?

CodePudding user response:

This is not a legitimate javascript syntax;

This should be JSX grammar, the need to use the Babel or certain types of file loader translated into correct grammar,

CodePudding user response:

Js four brackets usage:
1. Improve the priority, (3 + 5) * 2 is not equal to 3 + 5 * 2
2. As part of the other grammar, responsible for the circle function () {} the if () (function () {}) ()
3. The execution of the function the add ()
4. Nothing is circle, look good (6)
  • Related