master
yutent 2022-03-11 16:48:07 +08:00
parent d717fd0804
commit 98bd1fd292
3 changed files with 8 additions and 10 deletions

View File

@ -30,7 +30,7 @@
<div class="wrapper flex column"> <div class="wrapper flex column">
<header class="table-info flex alc"> <header class="table-info flex alc">
单字{{single}}个, 词组{{words}}个! 单字{{single}}个, 词组{{words}}个!
</header> </header>
<div class="search"> <div class="search">

View File

@ -34,7 +34,8 @@ Anot({
fetch('./data/table.txt') fetch('./data/table.txt')
.then(r => r.text()) .then(r => r.text())
.then(r => { .then(r => {
// console.log(r) //
r.split('\n').forEach(it => { r.split('\n').forEach(it => {
it = it it = it
.trim() .trim()
@ -48,10 +49,6 @@ Anot({
} }
}) })
window.foo = WB_TABLE
console.log(WB_TABLE)
this.single = WB_TABLE.length this.single = WB_TABLE.length
}) })
}, },
@ -70,10 +67,10 @@ Anot({
params.txt = params.txt.replace(/[\sa-z]/g, '') params.txt = params.txt.replace(/[\sa-z]/g, '')
} }
if (params.txt.length > 1) { if (reverse || params.txt.length === 1) {
res = params.txt.split('').map(t => WB_TABLE.get(t))
} else {
res = [WB_TABLE.get(params.txt)] res = [WB_TABLE.get(params.txt)]
} else {
res = params.txt.split('').map(t => WB_TABLE.get(t))
} }
if (reverse) { if (reverse) {
@ -100,7 +97,7 @@ Anot({
.join('\n') .join('\n')
} }
this.result = `查询结果: \n${res}` this.result = `查询耗时: ${t1}ms\n查询结果: \n${res}`
} }
} }
}) })

View File

@ -48,6 +48,7 @@ export class Enum {
} }
get(k) { get(k) {
console.log('>>>>', k)
if (this.#dict_k[k]) { if (this.#dict_k[k]) {
return this.#dict_k[k] return this.#dict_k[k]
} else if (this.#dict_v[k]) { } else if (this.#dict_v[k]) {