Clean vuex

This commit is contained in:
2020-07-05 14:57:09 +02:00
parent ccb046a08a
commit 8c6c40cd78
4 changed files with 11 additions and 11 deletions
+4 -3
View File
@@ -9,7 +9,7 @@
</template>
<script>
import { mapState, mapActions } from 'vuex'
import { mapState, mapActions, mapGetters } from 'vuex'
import renderMarkdown from '@/utils/markdown'
export default {
@@ -20,6 +20,7 @@ export default {
}),
computed: {
...mapState('notes', ['notes', 'isInitialized']),
...mapGetters('notes', ['find']),
uuid() {
return this.$route.params.uuid
},
@@ -27,11 +28,11 @@ export default {
mounted() {
if (!this.isInitialized) {
this.load().then(() => {
this.note = this.notes.find((e) => e.uuid === this.uuid)
this.note = this.find(this.uuid)
this.render()
})
} else {
this.note = this.notes.find((e) => e.uuid === this.uuid)
this.note = this.find(this.uuid)
this.render()
}
},
+3 -3
View File
@@ -1,5 +1,5 @@
<template>
<div class="container p-4 mx-auto bg-gray-700">
<div class="container p-4 mx-auto bg-gray-800">
<h1 class="text-center">My Notes</h1>
<input
id="search"
@@ -10,9 +10,9 @@
/>
<div v-for="note in notes" :key="note.uuid">
<div class="flex justify-between items-center">
<router-link :to="'/notes/' + note.uuid" class="text-lg">{{
<nuxt-link :to="'/notes/' + note.uuid" class="text-lg">{{
note.title
}}</router-link>
}}</nuxt-link>
<div class="py-2">
<span
v-for="(tag, index) in note.tags"