-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add samples for various export syntax
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { writable } from '../../../../store'; | ||
|
||
export default { | ||
props: { | ||
s1: writable(42), | ||
s2: writable(43), | ||
p1: 2, | ||
p3: 3, | ||
a1: writable(1), | ||
a2: 4, | ||
a6: writable(29), | ||
for: 'loop', | ||
continue: '...', | ||
}, | ||
|
||
html: ` | ||
$s1=42 | ||
$s2=43 | ||
p1=2 | ||
p3=3 | ||
$v1=1 | ||
v2=4 | ||
vi1=4 | ||
$vs1=1 | ||
vl1=test | ||
$s3=29 | ||
loop... | ||
` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<script> | ||
// export multiple subscribables in one line | ||
export let u1, s1, u2, s2 | ||
let p1, p2, p3 | ||
// export previously declared props | ||
export { p1, p3 } | ||
// aliased props <component a1={...} a2={...}> assign to v1, v2 | ||
let v1, v2 | ||
export { v1 as a1, v2 as a2 } | ||
// aliased export with initializer | ||
let vi1 = v2 | ||
export { vi1 as a3 } | ||
// aliased subscribable export | ||
let vs1 = v1 | ||
export { vs1 as a4 } | ||
// aliased with literal initializer | ||
let vl1 = 'test' | ||
export { vl1 as a5 } | ||
// aliased store surrounded by non-aliased non-stores | ||
let n1, n2, s3 | ||
export { n1, s3 as a6, n2 } | ||
// keyword exports | ||
let k1, k2 | ||
export { k1 as for, k2 as continue } | ||
</script> | ||
|
||
$s1={$s1} | ||
$s2={$s2} | ||
p1={p1} | ||
p3={p3} | ||
$v1={$v1} | ||
v2={v2} | ||
vi1={vi1} | ||
$vs1={$vs1} | ||
vl1={vl1} | ||
$s3={$s3} | ||
{k1}{k2} |