summaryrefslogtreecommitdiff
path: root/demo/components/chat.js
diff options
context:
space:
mode:
authortheia2023-02-03 15:45:30 -0500
committertheia2023-02-03 15:45:30 -0500
commit010cd54018c3079b240cc3c679c7378482452e42 (patch)
tree15b376dc94b829c7e570040d428548b369fe70a8 /demo/components/chat.js
parente7b3ab608533d137a2d244342b651841ba7af506 (diff)
made GraffitiArray work even after second-level functions + like button to demo
Diffstat (limited to 'demo/components/chat.js')
-rw-r--r--demo/components/chat.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/demo/components/chat.js b/demo/components/chat.js
index 86d8fe7..08b478b 100644
--- a/demo/components/chat.js
+++ b/demo/components/chat.js
@@ -1,13 +1,13 @@
import { Name } from './name.js'
+import LikeButton from './like-button.js'
export default {
- components: { Name },
-
- props: ['tags'],
+ components: { Name, LikeButton },
data: ()=> ({
- message: ''
+ message: '',
+ channel: 'demo'
}),
methods: {
@@ -25,20 +25,23 @@ export default {
this.$graffitiUpdate({
message: this.message,
timestamp: Date.now(),
- _tags: this.tags
+ _tags: [this.channel]
})
this.message = ''
}
},
template: `
- <graffiti-objects :tags="tags" v-slot="{objects}">
+ Chat Channel: <input v-model="channel"/>
+
+ <graffiti-objects :tags="[channel]" v-slot="{objects}">
<ul v-for="object in messageObjects(objects)">
<li>
<em><Name :of="object._by"/></em>:
-
{{ object.message }}
+ <LikeButton :messageID="object._id" />
+
<template v-if="object._by==$graffitiMyID">
<button @click="object.message+='!!';object._update()">
‼️