Last active
March 28, 2018 15:33
Revisions
-
paulocoghi revised this gist
Mar 23, 2018 . 3 changed files with 8 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -19,4 +19,6 @@ store: () => store }; window.store = store; </script> This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -13,6 +13,8 @@ methods: { push }, store: () => window.store }; </script> This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -26,6 +26,8 @@ export default { methods: { splice }, store: () => window.store }; </script> -
paulocoghi revised this gist
Mar 23, 2018 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ <InputAdd></InputAdd> <List></List> <script> import InputAdd from './InputAdd.html' import List from './List.html' import { Store } from 'svelte/store.js'; @@ -13,7 +13,7 @@ export default { components: { InputAdd, List, }, File renamed without changes. -
paulocoghi created this gist
Mar 23, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ <input bind:value='newTodo' placeholder='buy milk'> <button on:click='push("$todos", newTodo)'>add todo</button> <script> import { push } from 'svelte-extras'; export default { data: function () { return { newTodo: '' }; }, methods: { push } }; </script> This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ <Add></Add> <List></List> <script> import Add from './Add.html' import List from './List.html' import { Store } from 'svelte/store.js'; const store = new Store( { todos: [ 'Item 1', 'Item 2' ] }, ); export default { components: { Add, List, }, store: () => store }; </script> This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ <ul> {{#each $todos as todo, i}} <li> <button on:click='splice("$todos", i, 1)'>x</button> {{todo}} </li> {{/each}} </ul> <style> ul { list-style: none; padding: 0; } li button { color: rgb(200,0,0); background: rgba(200,0,0,0.1); border-color: rgba(200,0,0,0.2); padding: 0.2em 0.5em; } </style> <script> import { splice } from 'svelte-extras'; export default { methods: { splice } }; </script> This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ ## Multiple components and store variables ($) Just trying (and failing) to work with Svelte's store variables with multiple components.