浏览代码

show no result

thomas 3 年之前
父节点
当前提交
14fddbae2c
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. 9 3
      src/components/AdminCommands.vue

+ 9 - 3
src/components/AdminCommands.vue

@@ -35,11 +35,17 @@ export default class AdminCommands extends Vue {
   cnt = 0
 
   setResponse(data) {
-    if(! Array.isArray(data)) {
-      data = []
+    this.responses = []
+
+    if(Array.isArray(data) == false || data.length == 0) {
+      this.cnt++
+      this.responses.push({
+        cnt: this.cnt,
+        data: 'no results'
+      })
+      return
     }
 
-    this.responses = []
     for (let index = 0; index < data.length; index++) {
       this.cnt++
       this.responses.push({