From e1a8471e5abe0f199f259efe5c8fef3e08566991 Mon Sep 17 00:00:00 2001
From: heixinyouzi <2410633923@qq.com>
Date: Mon, 4 Nov 2024 11:00:34 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/home/search.vue | 80 +++++++++++++++++++++++++++++++--------
1 file changed, 64 insertions(+), 16 deletions(-)
diff --git a/src/views/home/search.vue b/src/views/home/search.vue
index 4fd6b94..10ebe0e 100644
--- a/src/views/home/search.vue
+++ b/src/views/home/search.vue
@@ -3,14 +3,17 @@
@@ -26,7 +29,7 @@ const selectOptions = [
{ label: '必应', value: 'https://cn.bing.com/search?q=' },
{ label: '谷歌', value: 'https://www.google.com/search?q=' },
{ label: '百度', value: 'https://www.baidu.com/s?wd=' },
- { label: '翻译', value: '#' }
+ { label: '翻译', value: 'https://translate.volcengine.com?text=' }
]
const smodel = ref(false)
@@ -34,26 +37,60 @@ const input = ref(null)
const mos = ref(null)
const inWidth = ref(0)
const inHeight = ref(0)
-
+const item = ref(null)
//mark method
// https://cn.bing.com/search?q=111
function toSearch(i) {
console.log(666666);
if (!searchValue.value) return
- if (i == 3) {
- $msg.info('翻译功能正在开发中')
- return
- }
+ // if (i == 3) {
+ // $msg.info('翻译功能正在开发中')
+ // return
+ // }
window.open(selectOptions[i].value + searchValue.value, "_blank")
}
-function inputBlur() {
+
+function inputFocus() {
+ smodel.value = true
+}
+function inputBlur(e) {
+
+ if (e.relatedTarget) return
setTimeout(() => {
smodel.value = false
}, 200);
}
+function ulBlur() {
+ console.log("*******");
+ smodel.value = false
+}
+
+function itemBlur(e) {
+ if (!e.relatedTarget) {
+ setTimeout(() => {
+ smodel.value = false
+ }, 200);
+ }
+}
+
+function select() {
+ // 聚焦item0
+ // console.log(item.value[0]);
+ item.value[1].focus()
+}
+function downSelect(i) {
+
+ if (i == selectOptions.length - 1) item.value[0].focus()
+ else item.value[i + 1].focus()
+}
+
+function upSelect(i) {
+ if (i == 0) item.value[selectOptions.length - 1].focus()
+ else item.value[i - 1].focus()
+}
//mark 周期、内置函数等
onMounted(() => {
@@ -64,23 +101,34 @@ onMounted(() => {
})
-