[Vuejs]-How can I able to display "No data" if there is no data in the json response in vue js?

2👍

You should do this completely in the markup. Try this…

<div id="searchContent">
  <div v-for="row in vector">{{row.bussinessName}}</div>
  <div v-if="vector.length === 0">No search results</div>
<div>

0👍

Check data length in success.

success: function(e) {
       if(e.data.length > 0)
          window.searchContent.vector = e.data;
         else
           window.searchContent.vector= 'No search reults'
        }
👤4b0

Leave a comment