From 8ebbd2e2b831ba973dd97b5898e9dcb1c78b935a Mon Sep 17 00:00:00 2001 From: imyzt Date: Wed, 9 Oct 2024 23:15:41 +0800 Subject: [PATCH] pref:Set search title, easier to recognize in multiple tabs --- src/components/Results.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/Results.vue b/src/components/Results.vue index 15a9e9d..b2ae6c8 100644 --- a/src/components/Results.vue +++ b/src/components/Results.vue @@ -32,6 +32,10 @@ export default { script.async = true; document.head.appendChild(script); }, + setTitle() { + var inputContent = document.getElementsByName('search')[0].value; + document.title = inputContent + ' - Luxirty Search' + }, goHome() { // 使用 window.location.href 跳转到根路径 window.location.href = '/'; @@ -46,6 +50,9 @@ export default { anchor.removeAttribute('data-cturl'); anchor.removeAttribute('data-ctorig'); }); + + // 设置搜索标题,多页签时更好切换 + this.setTitle(); }; // 将回调注册到 Google Custom Search 引擎对象