mirror of
https://github.com/KoriIku/luxirty-search
synced 2024-11-21 16:18:13 +00:00
Merge branch 'main' of https://github.com/KoriIku/luxirty-search
Some checks are pending
/ build (push) Waiting to run
Some checks are pending
/ build (push) Waiting to run
This commit is contained in:
commit
e4ab1d52ec
@ -21,9 +21,13 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'SearchPage',
|
name: 'SearchPage',
|
||||||
|
props: ['query'],
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadGoogleCSE();
|
this.loadGoogleCSE();
|
||||||
this.setupResultsRenderedCallback(); // 注册渲染结果回调函数
|
this.setupResultsRenderedCallback(); // 注册渲染结果回调函数
|
||||||
|
if (!this.query) {
|
||||||
|
this.goHome();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadGoogleCSE() {
|
loadGoogleCSE() {
|
||||||
@ -44,7 +48,7 @@ export default {
|
|||||||
// 定义一个渲染回调函数,用于移除不需要的属性
|
// 定义一个渲染回调函数,用于移除不需要的属性
|
||||||
const myWebResultsRenderedCallback = () => {
|
const myWebResultsRenderedCallback = () => {
|
||||||
const links = document.querySelectorAll('a.gs-title');
|
const links = document.querySelectorAll('a.gs-title');
|
||||||
|
|
||||||
links.forEach((anchor) => {
|
links.forEach((anchor) => {
|
||||||
// 移除 'data-cturl' 和 'data-ctorig' 属性
|
// 移除 'data-cturl' 和 'data-ctorig' 属性
|
||||||
anchor.removeAttribute('data-cturl');
|
anchor.removeAttribute('data-cturl');
|
||||||
@ -92,7 +96,8 @@ export default {
|
|||||||
color: #58636f;
|
color: #58636f;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
user-select: none; /* 防止标题文字被选中 */
|
user-select: none;
|
||||||
|
/* 防止标题文字被选中 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 针对小屏幕的样式 */
|
/* 针对小屏幕的样式 */
|
||||||
|
@ -14,7 +14,8 @@ const router = createRouter({
|
|||||||
{
|
{
|
||||||
path: '/search',
|
path: '/search',
|
||||||
name: 'Results',
|
name: 'Results',
|
||||||
component: Results
|
component: Results,
|
||||||
|
props: route => ({ query: route.query.q })
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user