This commit is contained in:
@@ -48,11 +48,20 @@ function handleDeleteNote(key) {
|
||||
onMounted(() => {
|
||||
emitter.on("push-note", handlePushNote);
|
||||
emitter.on("delete-note", handleDeleteNote);
|
||||
emitter.on("title-updated", handleTitleUpdated);
|
||||
});
|
||||
|
||||
function handleTitleUpdated(data) {
|
||||
const note = noteData.value.find(n => n.key === data.key);
|
||||
if (note) {
|
||||
note.title = data.title;
|
||||
}
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
emitter.off("push-note", handlePushNote);
|
||||
emitter.off("delete-note", handleDeleteNote);
|
||||
emitter.off("title-updated", handleTitleUpdated);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user