|
@@ -17,6 +17,12 @@
|
|
<span data-todo-label x-text="$store.todoLabel.test"></span>
|
|
<span data-todo-label x-text="$store.todoLabel.test"></span>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
+ <div x-data>
|
|
|
|
+ <button data-change-name @click.prevent="$store.user.name = 'Bob'">
|
|
|
|
+ Change user name
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
<script src="/dist/spruce.umd.js"></script>
|
|
<script src="/dist/spruce.umd.js"></script>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
@@ -36,6 +42,10 @@
|
|
bar: 'boo'
|
|
bar: 'boo'
|
|
}, true)
|
|
}, true)
|
|
|
|
|
|
|
|
+ Spruce.store('user', {
|
|
|
|
+ name: 'Ryan'
|
|
|
|
+ })
|
|
|
|
+
|
|
Spruce.watch('todo.todos', () => {
|
|
Spruce.watch('todo.todos', () => {
|
|
Spruce.store('todoLabel').test = 'Yay!'
|
|
Spruce.store('todoLabel').test = 'Yay!'
|
|
})
|
|
})
|
|
@@ -43,6 +53,10 @@
|
|
Spruce.watch('persisted.foo', () => {
|
|
Spruce.watch('persisted.foo', () => {
|
|
Spruce.store('persisted').bar = 'bop'
|
|
Spruce.store('persisted').bar = 'bop'
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+ Spruce.watch('user', () => {
|
|
|
|
+ Spruce.store('todoLabel').test = 'Changed!'
|
|
|
|
+ })
|
|
</script>
|
|
</script>
|
|
</body>
|
|
</body>
|
|
</html>
|
|
</html>
|