-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathexpression.html
More file actions
33 lines (28 loc) · 1.11 KB
/
expression.html
File metadata and controls
33 lines (28 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!--
Copyright (c) 2018, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: MIT
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
-->
<template>
<!-- Basic expressions (already working) -->
<div data-foo="{expr1()}"></div>
<p class="{expr2.expr21.expr22}"></p>
<p>{expr3[0]['expr3' + '3']}</p>
<!-- Complex expressions that require experimentalComplexExpressions -->
<div class="{`complex-${expr1()}-${expr2.expr21.expr22}`}">
{`Template literal: ${expr1()} and ${expr2.expr21.expr22}`}
</div>
<p data-computed="{expr1() ? 'truthy' : 'falsy'}">
{expr1() ? 'Conditional: ' + expr1() : 'Default value'}
</p>
<div class="{expr2?.expr21?.expr22 || 'fallback'}">
{expr2?.expr21?.expr22 ?? 'nullish fallback'}
</div>
<p data-array="{expr3.map(item => item.expr33).join(', ')}">
{expr3.length > 0 ? `Array length: ${expr3.length}` : 'Empty array'}
</p>
<div class="{expr1() === 'bar' ? 'matched' : 'not-matched'}">
{expr1() === 'bar' ? 'String comparison works!' : 'String comparison failed'}
</div>
</template>