11.7 Display “No search results” & Hide the “No tasks today” Banner

This commit is contained in:
Fredrick W Warren 2021-02-10 15:00:21 -08:00
parent 001b7c6b85
commit 6bde7fce56

View File

@ -5,11 +5,15 @@
<search /> <search />
</div> </div>
<p
v-if="search && !Object.keys(tasksTodo).length && !Object.keys(tasksCompleted).length">
No Search Results
</p>
<noTasks <noTasks
v-if="!Object.keys(tasksTodo).length" /> v-if="!Object.keys(tasksTodo).length && !search" />
<tasks-todo <tasks-todo
v-else v-if="Object.keys(tasksTodo).length"
:tasksTodo="tasksTodo" /> :tasksTodo="tasksTodo" />
<tasks-completed <tasks-completed
@ -34,7 +38,7 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters, mapState } from 'vuex'
import tasksTodo from 'components/Tasks/TasksTodo.vue' import tasksTodo from 'components/Tasks/TasksTodo.vue'
import noTasks from 'components/Tasks/NoTasks.vue' import noTasks from 'components/Tasks/NoTasks.vue'
import tasksCompleted from 'components/Tasks/TasksCompleted.vue' import tasksCompleted from 'components/Tasks/TasksCompleted.vue'
@ -56,7 +60,8 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters('tasks', ['tasksTodo', 'tasksCompleted']) ...mapGetters('tasks', ['tasksTodo', 'tasksCompleted']),
...mapState('tasks', ['search'])
}, },
mounted () { mounted () {
this.$root.$on('showAddTask', () => { this.$root.$on('showAddTask', () => {