mirror of
https://github.com/kou029w/hasura-rest-hands-on.git
synced 2025-01-18 08:05:12 +00:00
fix: 更新処理が誤って行われる問題を修正
This commit is contained in:
parent
761b91a467
commit
b751fcb654
1 changed files with 3 additions and 9 deletions
|
@ -16,8 +16,7 @@ window.localStorage.setItem("id", id);
|
|||
const endpoint = `https://memo-demo.hasura.app/api/rest/page/${id}`;
|
||||
|
||||
const editor = ref();
|
||||
const initialContent = { ops: [{ insert: "読み込み中…" }] };
|
||||
const defaultContent = {
|
||||
const initialContent = {
|
||||
ops: [
|
||||
{ insert: "メモ帳\n", attributes: { header: 1 } },
|
||||
{ insert: "こんにちは!\n" },
|
||||
|
@ -33,7 +32,7 @@ const defaultContent = {
|
|||
onMounted(async () => {
|
||||
console.log("endpoint", endpoint);
|
||||
const res = await axios.get(endpoint);
|
||||
const content = res.data.page?.content ?? defaultContent;
|
||||
const content = res.data.page?.content ?? initialContent;
|
||||
editor.value.setContents(content);
|
||||
console.log("content", content);
|
||||
});
|
||||
|
@ -45,10 +44,5 @@ const update = debounce(async (content) => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<QuillEditor
|
||||
ref="editor"
|
||||
:content="initialContent"
|
||||
@update:content="update"
|
||||
toolbar="full"
|
||||
/>
|
||||
<QuillEditor ref="editor" @update:content="update" toolbar="full" />
|
||||
</template>
|
||||
|
|
Loading…
Add table
Reference in a new issue