Skip to content
This repository was archived by the owner on Mar 22, 2022. It is now read-only.

Commit e5e097a

Browse files
committed
Can delete an article
1 parent 0621609 commit e5e097a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/components/Editor.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
<button class="addMemoBtn" @click="addMemo">
2222
メモの追加
2323
</button>
24+
<button class="deleteMemoBtn" v-if="memos.length > 1" @click="deleteMemo">
25+
選択中のメモの削除
26+
</button>
2427
</div>
2528
<textarea class="markdown" v-model="memos[selectedIndex].markdown"></textarea>
2629
<div class="preview" v-html="preview()"></div>
@@ -63,6 +66,12 @@ export default {
6366
},
6467
displayTitle: function(text) {
6568
return text.split(/\n/)[0]
69+
},
70+
deleteMemo: function() {
71+
this.memos.splice(this.selectedIndex, 1)
72+
if (this.selectedIndex > 0) {
73+
this.selectedIndex--
74+
}
6675
}
6776
}
6877
}

0 commit comments

Comments
 (0)