File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ You have full control over the delimiters used for injecting locals, as well as
4343| ** unescapeDelimiters** | ` ['{{{', '}}}'] ` | Array containing beginning and ending delimiters for unescaped locals |
4444| ** locals** | ` {} ` | Object containing any local variables you want to be available inside your expressions |
4545| ** conditionalTags** | ` ['if', 'elseif', 'else'] ` | Array containing names for tags used for ` if/else if/else ` statements |
46+ | ** switchTags** | ` ['switch', 'case', 'default'] ` | Array containing names for tags used for ` switch/case/default ` statements |
4647| ** loopTags** | ` ['each'] ` | Array containing names for ` for ` loops |
4748| ** scopeTags** | ` ['scope'] ` | Array containing names for scopes |
4849
@@ -155,6 +156,34 @@ else
155156 p Foo is probably just foo in the end.
156157```
157158
159+ ### Switch statement
160+
161+ Switch statements act like streamline conditionals. They are useful for when you want to compare a single variable against a series of constants.
162+
163+ ``` js
164+ locals: { foo: ' foo' }
165+ ```
166+
167+ ``` html
168+ <switch expression =" foo" >
169+ <case n =" 'bar'" >
170+ <p >Foo really is bar! Revolutionary!</p >
171+ </case >
172+ <case n =" 'wow'" >
173+ <p >Foo is wow, oh man.</p >
174+ </case >
175+ <default >
176+ <p >Foo is probably just foo in the end.</p >
177+ </default >
178+ </switch >
179+ ```
180+
181+ ``` html
182+ <p >Foo is probably just foo in the end.</p >
183+ ```
184+
185+ Anything in the ` expression ` attribute is evaluated directly as an expressions.
186+
158187### Loops
159188
160189You can use the ` each ` tag to build loops. It works with both arrays and objects. For example:
You can’t perform that action at this time.
0 commit comments