Renovamen / vuepress-theme-gungnir

A blog theme for VuePress 2.
https://v2-vuepress-theme-gungnir.vercel.app
Apache License 2.0
358 stars 80 forks source link

[Bug report]搜索提示文字修改不生效 #53

Closed jarvis920817 closed 2 years ago

jarvis920817 commented 2 years ago

✅ Checklist

🔎 Description

Concise Description

修改placeholder值后仍为「默认值$grep...」

Expected behavior

修复该功能。在无搜索结果时,在下方添加显示提示“未找到目标…”之类的提示字样。

Steps to reproduce

Screenshots or Screen Recording (if possible)

📄 Environment info (npx vuepress info)

-

🔗 Reproduction link / repo:

No response

Renovamen commented 2 years ago

修改placeholder值后仍为「默认值$grep...」

可以看一下你的 .vuepress/config.js 文件吗?我这边按文档的方式配置 placeholder 是没问题的。

jarvis920817 commented 2 years ago

邹大大,感谢您的回复。 麻烦您了。

在 2022-04-11 02:57:47,"Xiaohan Zou" @.***> 写道:

修改placeholder值后仍为「默认值$grep...」

可以看一下你的 .vuepress/config.js 文件吗?我这边按文档的方式配置 placeholder 是没问题的。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***> const isProd = process.env.NODE_ENV === "production";

module.exports = { title: "Dragon Well - 龍井", description: "JARVIS CHEUNG 的博客",

head: [ [ "link", { rel: "icon", type: "image/png", sizes: "16x16", href: /img/logo/favicon-16x16.png } ], [ "link", { rel: "icon", type: "image/png", sizes: "32x32", href: /img/logo/favicon-32x32.png } ], ["meta", { name: "application-name", content: "JARVIS CHEUNG" }], ["meta", { name: "apple-mobile-web-app-title", content: "JARVIS CHEUNG" }], [ "meta", { name: "apple-mobile-web-app-status-bar-style", content: "black" } ], [ "link", { rel: "apple-touch-icon", href: /images/icons/apple-touch-icon.png } ], ["meta", { name: "theme-color", content: "#377bb5" }], ["meta", { name: "msapplication-TileColor", content: "#377bb5" }] ],

bundler: @.***/vite",

theme: "vuepress-theme-gungnir",

themeConfig: { docsDir: "blog", docsBranch: "master",

locales: {
  "/": {
    lang: 'zh-CN',
    navbarTitle: "Dragonwell",
    searchText: "查找",
  },
  "/en/": {
    lang: 'en-US',
    selectLanguageName: 'English',
    navbarTitle: "Dragonwell",
    searchText: "Search",
  }
},
search: {
  locales: {
    "/": {
      placeholder: "输入任意关键词"
    },
    "/en/": {
      placeholder: "Search"
    },
  }
},

// personal information
personalInfo: {
  name: "Dragon Well - 龍井",
  avatar: "/img/avatar.png",
  description: "JARVIS CHEUNG 的个人主页",
  sns: {
    email: {
      icon:"hi-mail",
      ***@***.***"
    },
    wechat: {  
      icon: "ri-wechat-2-line", 
      link: "/contact/wechat" 
    },
    // weibo: "", 
    // twitter: "",
    // github: "jarvis920817",
    // zhihu: "",
    // linkedin: "",
    // facebook: "",
    // rss: ""
  }
},

// header images on home page
homeHeaderImages: [
  {
    path: "/img/home-bg/1.jpg",
    mask: "rgba(40, 57, 101, .1)"
  },
  {
    path: "/img/home-bg/2.jpg",
    mask: "rgba(196, 176, 131, .1)"
  },
  {
    path: "/img/home-bg/3.jpg",
    mask: "rgba(68, 74, 83, .1)"
  },
  {
    path: "/img/home-bg/4.jpg",
    mask: "rgba(19, 75, 50, .2)"
  },
  {
    path: "/img/home-bg/5.jpg"
  }
],

// other pages
pages: {
  tags: {
    bgImage: {
      path: "/img/pages/tags.jpg",
      mask: "rgba(211, 136, 37, .5)"
    },
    links: {
      bgImage: {
        path: "/img/pages/links.jpg",
        mask: "rgba(64, 118, 190, 0.5)"
      }
    }
  }
},

themePlugins: {
  // only enable git plugin in production mode
  git: isProd,
  katex: true,
  mdPlus: {
    all: true
  },
  // giscus: {
  //   repo: "This-is-an-Apple/blog-giscus-comments",
  //   repoId: "R_kgDOGl2SjQ",
  //   category: "Announcements",
  //   categoryId: "DIC_kwDOGl2Sjc4CAcxK",
  //   darkTheme: "https://zxh.io/styles/giscus-dark.css"
  // },
  // ga: "G-HCQSX53XFG",
  // ba: "75381d210789d3eaf855fa16246860cc",
  // rss: {
  //   siteURL: "https://zxh.io",
  //   copyright: "DragonWell 2020-2022"
  // }
},

navbar: [
  {
    text: "首页",
    link: "/",
    icon: "ri-home-5-fill"
  },
  {
    text: "文章",
    link: "/tags/",
    icon: "md-article"
  },
  {
    text: "关于我",
    link: "/about/",
    icon: "io-person-sharp"
  },
],

footer: `
  <div class="footer-container">
    <div class="footer-left">
        <svg xmlns="http://www.w3.org/2000/svg" width="117" height="28"  viewBox="0 0 117 28"><path d="M.914 22V1.375h5.672c1.484 0 2.602.414 3.352 1.242.75.82 1.124 2.024 1.124 3.61v9.656c0 1.953-.343 3.46-1.03 4.523C9.351 21.47 8.155 22 6.444 22zm4.148-3.644h.715c.758 0 1.137-.368 1.137-1.102V6.614c0-.688-.094-1.13-.281-1.325-.18-.203-.551-.305-1.113-.305h-.457zM12.75 22V1.375h6.328c1.055 0 1.852.242 2.39.727.54.476.9 1.148 1.079 2.015.187.86.281 1.871.281 3.035 0 1.125-.144 2.024-.434 2.696-.28.671-.816 1.136-1.605 1.394.648.133 1.102.457 1.36.973.265.508.398 1.168.398 1.98V22H18.48v-8.074c0-.602-.125-.973-.375-1.113-.242-.149-.636-.223-1.183-.223V22zm4.195-12.984h.996c.57 0 .856-.621.856-1.864 0-.804-.063-1.332-.188-1.582s-.359-.375-.703-.375h-.96zM23.625 22l1.992-20.625h6.996L34.57 22h-3.902l-.293-3.328h-2.484L27.633 22zm4.559-6.621h1.875L29.156 4.89h-.187zm11.906 6.809c-2.946 0-4.418-2.11-4.418-6.329V6.965c0-3.852 1.687-5.777 5.062-5.777 1.391 0 2.457.28 3.2.843.742.555 1.253 1.367 1.535 2.438.281 1.07.422 2.375.422 3.914h-4.032V6.555c0-.446-.062-.817-.187-1.114-.117-.304-.367-.457-.75-.457-.477 0-.793.16-.95.48a2.491 2.491 0 0 0-.222 1.056v9.996c0 .554.07 1.007.21 1.359.15.344.434.516.856.516.438 0 .727-.172.868-.516.148-.352.222-.813.222-1.383v-2.941h-1.101V9.988h5.039V22H44.19l-.703-1.734c-.719 1.28-1.851 1.922-3.398 1.922zm12.316 0c-1.648 0-2.91-.497-3.785-1.489-.867-1-1.3-2.441-1.3-4.324V6.578c0-1.766.429-3.105 1.288-4.02.868-.913 2.133-1.37 3.797-1.37 1.664 0 2.926.457 3.785 1.37.868.915 1.301 2.255 1.301 4.02v9.797c0 1.883-.437 3.324-1.312 4.324-.868.992-2.125 1.488-3.774 1.488zm.035-3.797c.625 0 .938-.606.938-1.817V6.508c0-1.016-.305-1.524-.914-1.524-.688 0-1.031.52-1.031 1.559v10.055c0 .64.078 1.101.234 1.382.156.274.414.41.773.41zM59.156 22V1.375h4.242l1.899 9.879V1.375h3.984V22H65.25l-2.063-10.313V22zm13.57 0L70.513 1.375h4.031l1.137 13.02 1.16-13.02h3.844l1.101 13.02 1.102-13.02h4.078L84.715 22H79.77l-1.032-9.926L77.754 22zm15.47 0V1.375h8.25v3.984H92.39v4.02h3.89v3.879h-3.89v4.723h4.324V22zm9.89 0V1.375h4.125v17.11h4.242V22zm9.539 0V1.375h4.125v17.11h4.242V22z"/></svg>
      <div class="footer-links">
        <a href="/">首页</a>
        <a href="/tags/"  target="_blank">文章</a>
        <a href="/links/" target="_blank">链接</a>
      </div>
    </div>
    <div class="footer-right">
      <div class="footer-social">
        <a ***@***.***"> 
            <svg width="23" height="23" fill="currentColor" viewBox="0 0 24 24">
            <path d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm17 4.238l-7.928 7.1L4 7.216V19h16zM4.511 5l7.55 6.662L19.502 5z"/>
            </svg>
        </a>
        <a href="/contact/wechat" target="_blak">
          <svg aria-hidden="true" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
          <path d="M8.667 11.511a1.279 1.279 0 0 1-1.285-1.285c0-.718.567-1.286 1.285-1.286.717 0 1.285.568 1.285 1.286 0 .717-.568 1.285-1.285 1.285zm6.666 0a1.28 1.28 0 0 1-1.19-.792 1.275 1.275 0 0 1-.095-.493c0-.718.568-1.286 1.285-1.286.718 0 1.285.568 1.285 1.286 0 .717-.567 1.285-1.285 1.285zm-8.51 7.704l.715-.436a4 4 0 0 1 2.705-.536c.212.033.386.059.52.076.406.054.82.081 1.237.081 4.42 0 7.9-3.022 7.9-6.6S16.42 5.2 12 5.2s-7.9 3.022-7.9 6.6c0 1.366.5 2.673 1.432 3.781.048.057.12.137.214.235a3.999 3.999 0 0 1 1.101 3.102l-.025.297zm-.63 2.727a1 1 0 0 1-1.527-.93l.188-2.26a2 2 0 0 0-.55-1.551A7.059 7.059 0 0 1 4 16.868c-1.194-1.421-1.9-3.173-1.9-5.068 0-4.75 4.432-8.6 9.9-8.6s9.9 3.85 9.9 8.6-4.432 8.6-9.9 8.6c-.51 0-1.01-.033-1.499-.098a23.7 23.7 0 0 1-.569-.084 2 2 0 0 0-1.353.268l-2.387 1.456z"/>
          </svg>
        </a>
      </div>
      <div class="footer-copyright">
        &copy; DragonWell 2020-2022. All rights reserved.
      </div>
    </div>
  </div>
`

},

// markdown: { // extractHeaders: { // level: [2, 3, 4, 5] // }, // code: { // lineNumbers: false // } // }

// hitokoto: "https://v1.hitokoto.cn?c=d&c=i", // enable hitokoto (一言) or not? };

Renovamen commented 2 years ago

把这一段:

search: {
  locales: {
    "/": {
      placeholder: "输入任意关键词"
    },
    "/en/": {
      placeholder: "Search"
    },
  }
}

移到 themeConfig.themePlugins 里试试:

themePlugins: {
  search: {
    locales: {
      "/": {
        placeholder: "Search"
      },
      "/zh/": {
        placeholder: "搜索"
      },
    }
  }
}

placeholder 是插件的配置项。

jarvis920817 commented 2 years ago

成功Debug,感谢感谢。