feat(typeartice.vue): add baidu translate

This commit is contained in:
zyronon
2023-09-10 23:52:59 +08:00
parent 7b1b82430a
commit f22a6fb322
7 changed files with 349 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ import {useEventListener} from "@/hooks/useEvent.ts";
import TypeWord from "@/components/Practice/TypeWord.vue";
import {emitter, EventKey} from "@/utils/eventBus.ts";
import Baidu from "@opentranslate/baidu";
import {AxiosInstance} from "@/utils/http";
let article1 = `How does the older investor differ in his approach to investment from the younger investor?
There is no shortage of tipsters around offering 'get-rich-quick' opportunities. But if you are a serious private investor, leave the Las Vegas mentality to those with money to fritter. The serious investor needs a proper 'portfolio' -- a well-planned selection of investments, with a definite structure and a clear aim. But exactly how does a newcomer to the stock market go about achieving that?
@@ -96,12 +97,13 @@ onMounted(() => {
let sections = useSplitArticle(article.article)
let temp = useSplitCNArticle(article.articleTranslate, 'cn', CnKeyboardMap)
const baidu = new Baidu({
axios: AxiosInstance,
config: {
appid: "20230910001811857",
key: "Xxe_yftQR3K3Ue43NQMC"
}
})
baidu.translate('fuck', 'en','zh-CN').then(r => {
baidu.translate('fuck', 'en', 'zh-CN').then(r => {
console.log('s', r)
})
practiceStore.total = 0