Jelajahi Sumber

added 'aucun resultats' in empty search results

bach 1 tahun lalu
induk
melakukan
58a42b4f93
2 mengubah file dengan 4 tambahan dan 3 penghapusan
  1. 2 2
      src/stores/search.js
  2. 2 1
      src/views/Search.vue

+ 2 - 2
src/stores/search.js

@@ -17,8 +17,8 @@ export const SearchStore = defineStore({
   state: () => ({
     keys: null,
     contentTypeFilter: 'concernements',
-    results: [],
-    loaded_results: []
+    results: null,
+    loaded_results: null
   }),
   getters: {
     

+ 2 - 1
src/views/Search.vue

@@ -101,7 +101,7 @@ export default {
 
       <main>
         <section class="results">
-          <ul>
+          <ul v-if="loaded_results && loaded_results.length">
             <li v-for="result in loaded_results">
               <template v-if="results.content_type === 'entites'">
                 <h1 @click.prevent="onClickResult(result.concernement.id, result.id)">
@@ -121,6 +121,7 @@ export default {
               </template>            
             </li>
           </ul>
+          <div v-else-if="loaded_results">Aucun résultats</div>
         </section>
       </main>