浏览代码

Merge branch 'dev/v1.2.12_yf' of jianyu/jy-docs into feature/v1.2.12

yangfeng 1 年之前
父节点
当前提交
dd8cbeb59a
共有 2 个文件被更改,包括 16 次插入2 次删除
  1. 5 0
      jydocs-mobile/src/router/index.ts
  2. 11 2
      jydocs-mobile/src/views/Search.vue

+ 5 - 0
jydocs-mobile/src/router/index.ts

@@ -8,6 +8,11 @@ if (process.env.NODE_DEV !== 'production') {
   Vue.use(VueRouter)
 }
 
+const originalReplace = VueRouter.prototype.replace
+VueRouter.prototype.replace = function replace(location) {
+  return originalReplace.call(this, location).catch(err => err)
+}
+
 let routes = [
   {
     path: '/',

+ 11 - 2
jydocs-mobile/src/views/Search.vue

@@ -184,6 +184,7 @@ export default class extends Vue {
       this.historykeyList = docStorage?.data.docs
     }
     this.updateLayoutConfig({
+      actionLeftHide: true,
       headerStyle: {
         display: 'none',
         height: 0
@@ -230,6 +231,11 @@ export default class extends Vue {
   savesearchHistory () {
     const key: string = this.listState.value + ''
     // 兼容剑鱼搜索通用缓存格式 JY-MOBILE--login-clear-AllSearchHistory
+    const storage = localStorage.getItem('JY-MOBILE--login-clear-AllSearchHistory')
+    if (storage) {
+      const docStorage = JSON.parse(storage)
+      this.historykeyList = docStorage?.data.docs
+    }
     const isHave = this.historykeyList.some((v: any) => {
       return v.label === key
     })
@@ -328,6 +334,9 @@ export default class extends Vue {
 
   doSearch () {
     if (!this.listState.value) return
+    this.$router.replace({
+      query: { text: this.listState.value }
+    })
     this.savesearchHistory()
     const inputComponent = this.$refs.input as any
     inputComponent.setSearchContent(this.listState.value)
@@ -474,7 +483,7 @@ export default class extends Vue {
   .j-header {
     height: auto!important;
     flex-direction: column;
-    background: linear-gradient(280.62deg, #D7F6FB 1.93%, #E7FCFF 49.44%, #E7F2FF 98.41%);
+    background: linear-gradient(280.62deg, #D7F6FB 1.93%, #E7FCFF 49.44%, #E7F2FF 98.41%)!important;
   }
 
   .j-header:after {
@@ -500,7 +509,7 @@ export default class extends Vue {
       }
       .van-search__content{
         background: #fff;
-        border: 0;
+        border-color: transparent;
         border-radius: 4px;
       }
     }