tianyun 10 月之前
父節點
當前提交
352a32d487
共有 1 個文件被更改,包括 18 次插入13 次删除
  1. 18 13
      simple-demo/send_memos.html

+ 18 - 13
simple-demo/send_memos.html

@@ -81,7 +81,7 @@
                 </el-option>
             </el-select>
             <!--输入框,绑定回车事件,触发查询-->
-            <el-input style="margin-left: 30px; width: 40vw; padding-left: 10px" placeholder="搜索" v-model="searchStr" @change="search"></el-input>
+            <el-input style="margin-left: 30px; width: 40vw; padding-left: 10px" placeholder="搜索" v-model="searchStr" @change="searchStrChange"></el-input>
             <br><br>
             <div></div>
             <div style="display: flex;align-items:stretch; width: 70vw">
@@ -310,6 +310,16 @@
             if (item) {
                 this.contentStr = item;
             }
+            let queryStr = this.getQueryStr();
+            if (queryStr) {
+                this.searchStr = queryStr;
+            }
+            // 解码
+            let tagsStr = decodeURIComponent(getQueryString("tags"));
+            if (tagsStr) {
+                this.tagChecked = tagsStr.split(',')
+            }
+
             this.getAllTags();
             this.search();
 
@@ -318,6 +328,9 @@
             });
         },
         methods: {
+            searchStrChange() {
+                location.href = requestUtil.buildUrl(location.href, {'queryStr': this.searchStr})
+            },
             duoxuanChange() {
                 if (this.duoxuan) {
                     this.setDuoXuan('ok');
@@ -339,9 +352,6 @@
             getQueryStr() {
                 return getQueryString('queryStr')
             },
-            setQueryStr(content) {
-                location.href = requestUtil.buildUrl(location.href, {'queryStr': content})
-            },
             getDuoXuan() {
                 return getQueryString('duoxuan') == "ok";
             },
@@ -620,15 +630,10 @@
                 });
             },
             getAllTags: function () {
-                this.allTags = requestUtil.sync('https://memos.tianyunperfect.cn/api/v1/tag', 'get', null, myHeaders);
-                // 先检查url
-                let tagsStr = getQueryString("tags");
-                // 解码
-                tagsStr = decodeURIComponent(tagsStr);
-                if (tagsStr) {
-                    console.log(tagsStr)
-                    this.tagChecked = tagsStr.split(',')
-                }
+                this.allTags = requestUtil.async('https://memos.tianyunperfect.cn/api/v1/tag', 'get', null, myHeaders).then(res => {
+                    this.allTags = res;
+                })
+
             }
         }
     });