refactor(client): Use v-model for note component, freeze object

Related: #6595
This commit is contained in:
syuilo
2020-07-27 23:25:37 +09:00
parent cf43dd6ec5
commit 14b7f05af4
10 changed files with 111 additions and 70 deletions

View File

@@ -1,7 +1,7 @@
<template>
<button
class="hkzvhatu _button"
:class="{ reacted: myReaction == reaction, canToggle }"
:class="{ reacted: note.myReaction == reaction, canToggle }"
@click="toggleReaction(reaction)"
v-if="count > 0"
@touchstart="onMouseover"
@@ -11,7 +11,7 @@
ref="reaction"
v-particle="canToggle"
>
<x-reaction-icon :reaction="reaction" :custom-emojis="emojis" ref="icon"/>
<x-reaction-icon :reaction="reaction" :custom-emojis="note.emojis" ref="icon"/>
<span>{{ count }}</span>
</button>
</template>
@@ -30,14 +30,6 @@ export default Vue.extend({
type: String,
required: true,
},
myReaction: {
type: String,
required: false,
},
emojis: {
type: Array,
required: true,
},
count: {
type: Number,
required: true,
@@ -79,7 +71,7 @@ export default Vue.extend({
toggleReaction() {
if (!this.canToggle) return;
const oldReaction = this.myReaction;
const oldReaction = this.note.myReaction;
if (oldReaction) {
this.$root.api('notes/reactions/delete', {
noteId: this.note.id