add library, tsconfig.base.json

This commit is contained in:
polv committed 2021-10-25 05:19:13 +07:00
1 parent 0348f84255
commit ffbe5fed18
8 files changed
+758 -25

No files matched your search

+11 -10
View File
@@ -1,6 +1,6 @@
<template>
<section>
<div class="HanziPage">
<div class="CharacterTab">
<form class="field" @submit.prevent="q = q0">
<label for="q" class="label">
Search
@@ -29,7 +29,7 @@
<div class="columns">
<div class="column is-6 entry-display">
<div
class="hanzi-display clickable font-han"
class="character-display clickable font-han"
@click="(evt) => openContext(evt, current, 'character')"
@contextmenu.prevent="
(evt) => openContext(evt, current, 'character')
@@ -278,12 +278,14 @@ import { Component, Prop, Ref, Vue, Watch } from 'nuxt-property-decorator'
import ContextMenu from '@/components/ContextMenu.vue'
import { api, IEntry } from '~/assets/api'
const TITLE = 'Kanji'
@Component<CharacterTab>({
components: {
ContextMenu,
},
async created() {
this.$emit('title', 'Hanzi')
this.$emit('title', TITLE)
this.q = this.query.q || ''
@@ -357,7 +359,7 @@ export default class CharacterTab extends Vue {
@Watch('q')
async onQChange(q: string) {
this.$emit('title', (q ? q + ' - ' : '') + 'Hanzi')
this.$emit('title', (q ? q + ' - ' : '') + TITLE)
if (/\p{sc=Han}/u.test(q)) {
const qs = q.split('').filter((h) => /\p{sc=Han}/u.test(h))
@@ -381,7 +383,7 @@ export default class CharacterTab extends Vue {
@Watch('current')
load() {
if (this.current) {
this.loadHanzi()
this.loadCharacter()
this.loadVocab()
this.loadSentences()
} else {
@@ -399,7 +401,7 @@ export default class CharacterTab extends Vue {
}
}
async loadHanzi() {
async loadCharacter() {
if (!/^\p{sc=Han}$/u.test(this.current)) {
this.sub = []
this.sup = []
@@ -429,6 +431,7 @@ export default class CharacterTab extends Vue {
} = await api.all_getLookup({
entry: this.current,
type: 'character',
limit: 1,
})
this.reading = r?.reading || []
@@ -455,10 +458,9 @@ export default class CharacterTab extends Vue {
.map((r) =>
api
.all_getLookup({ entry: r.entry, type: 'vocabulary', limit: 1 })
.then((r) => r.result[0])
.then((r) => r.result[0]!)
)
.filter((r) => r)
.map((r) => r!)
)
}
@@ -478,10 +480,9 @@ export default class CharacterTab extends Vue {
.map((r) =>
api
.all_getLookup({ entry: r.entry, type: 'sentence', limit: 1 })
.then((r) => r.result[0])
.then((r) => r.result[0]!)
)
.filter((r) => r)
.map((r) => r!)
)
}
}