Support Svelte 3

fixes #546, #551, #552, #554
This commit is contained in:
Rich Harris
2019-02-03 14:29:47 -05:00
committed by GitHub
parent 83c8d7f855
commit ca034d0857
139 changed files with 1946 additions and 2016 deletions

View File

@@ -1 +1,5 @@
<h1>{params.slug.toUpperCase()}</h1>
<script>
import { page } from '@sapper/app';
</script>
<h1>{$page.params.slug.toUpperCase()}</h1>

View File

@@ -1,11 +1,13 @@
<h1>{letter}</h1>
<script context="module">
export function preload() {
return this.fetch('b.json').then(r => r.json()).then(letter => {
return { letter };
});
}
</script>
<script>
export default {
preload() {
return this.fetch('b.json').then(r => r.json()).then(letter => {
return { letter };
});
}
};
</script>
export let letter;
</script>
<h1>{letter}</h1>

View File

@@ -1,19 +1,17 @@
<button class='del' on:click='del()'>delete</button>
<script>
export default {
oncreate() {
window.deleted = null;
},
import { onMount } from 'svelte';
methods: {
del() {
fetch(`delete-test/42.json`, { method: 'DELETE' })
.then(r => r.json())
.then(data => {
window.deleted = data;
});
}
}
};
</script>
onMount(() => {
window.deleted = null;
});
function del() {
fetch(`delete-test/42.json`, { method: 'DELETE' })
.then(r => r.json())
.then(data => {
window.deleted = data;
});
}
</script>
<button class="del" on:click={del}>delete</button>

View File

@@ -1 +1,5 @@
<h1>{JSON.stringify(query)}</h1>
<script>
import { page } from '@sapper/app';
</script>
<h1>{JSON.stringify($page.query)}</h1>

View File

@@ -1,9 +1,7 @@
$&
<script context="module">
export function preload() {
return '$&';
}
</script>
<script>
export default {
preload() {
return '$&';
}
};
</script>
$&