Skip to content

Commit

Permalink
fixbug: display/style mix
Browse files Browse the repository at this point in the history
  • Loading branch information
Bistutu committed May 30, 2024
1 parent 614f9ec commit f96e954
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions components/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</el-tooltip>
</el-col>
<el-col :span="12">
<el-select v-model="config.style" placeholder="请选择翻译模式">
<el-select v-model="config.display" placeholder="请选择翻译模式">
<el-option
class="select-left"
v-for="item in options.display"
Expand All @@ -47,12 +47,12 @@
</el-row>

<!-- 如果选择了“双语翻译样式,则应显示译文显示样式”-->
<el-row v-show="config.style === 1" class="margin-bottom margin-left-2em">
<el-row v-show="config.display === 1" class="margin-bottom margin-left-2em">
<el-col :span="12" class="lightblue rounded-corner">
<span class="popup-text popup-vertical-left">译文样式</span>
</el-col>
<el-col :span="12">
<el-select v-model="config.display" placeholder="请选择译文显示样式">
<el-select v-model="config.style" placeholder="请选择译文显示样式">
<el-option
class="select-left"
v-for="item in options.styles"
Expand Down
4 changes: 2 additions & 2 deletions entrypoints/main/trans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function handleTranslation(mouseX: number, mouseY: number, delayTime: num
htmlSet.add(nodeOuterHTML);

// 根据翻译模式进行翻译
if (config.style === styles.bilingualTranslation) {
if (config.display === styles.bilingualTranslation) {
handleBilingualTranslation(node, delayTime > 0); // 根据 delayTime 可判断是否为滑动翻译
} else {
handleSingleTranslation(node, delayTime > 0);
Expand Down Expand Up @@ -200,7 +200,7 @@ export const handleBtnTranslation = throttle((node: any) => {
function bilingualAppendChild(node: any, text: string) {
let newNode = document.createElement("span");
newNode.classList.add("fluent-read-bilingual");
newNode.classList.add(options.styles[config.display].class);
newNode.classList.add(options.styles[config.style].class);
newNode.innerHTML = text;
smashTruncationStyle(node);
node.appendChild(newNode);
Expand Down

0 comments on commit f96e954

Please sign in to comment.