ソースを参照

added 'aucun resultats' in empty search results

bach 1 年間 前
コミット
58a42b4f93
2 ファイル変更4 行追加3 行削除
  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: () => ({
   state: () => ({
     keys: null,
     keys: null,
     contentTypeFilter: 'concernements',
     contentTypeFilter: 'concernements',
-    results: [],
-    loaded_results: []
+    results: null,
+    loaded_results: null
   }),
   }),
   getters: {
   getters: {
     
     

+ 2 - 1
src/views/Search.vue

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