Skip to content

Commit

Permalink
fix: 当在URL自定义输入搜索为空时,重定向到首页
Browse files Browse the repository at this point in the history
  • Loading branch information
bianxuerui committed Oct 11, 2024
1 parent 2aacdc7 commit b481254
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/Results.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default {
this.loadGoogleCSE();
this.setupResultsRenderedCallback(); // 注册渲染结果回调函数
if (!this.query) {
history.back();
this.goHome();
}
},
methods: {
Expand All @@ -48,7 +48,7 @@ export default {
// 定义一个渲染回调函数,用于移除不需要的属性
const myWebResultsRenderedCallback = () => {
const links = document.querySelectorAll('a.gs-title');
links.forEach((anchor) => {
// 移除 'data-cturl' 和 'data-ctorig' 属性
anchor.removeAttribute('data-cturl');
Expand Down Expand Up @@ -96,7 +96,8 @@ export default {
color: #58636f;
margin-right: 20px;
white-space: nowrap;
user-select: none; /* 防止标题文字被选中 */
user-select: none;
/* 防止标题文字被选中 */
}
/* 针对小屏幕的样式 */
Expand Down

0 comments on commit b481254

Please sign in to comment.