Skip to content

Commit

Permalink
feat: remove redundant code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
misitebao committed Nov 22, 2021
1 parent 96d2457 commit 5cf9d0f
Showing 1 changed file with 22 additions and 26 deletions.
48 changes: 22 additions & 26 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@
<div class="menu" data-wails-no-drag>
<div class="language">
<div
v-for="(item) in languages"
v-for="item in languages"
:key="item"
:class="{ active: item === locale }"
@click="onclickLanguageHandle(item)"
class="lang-item"
>{{ $t("languages." + item) }}</div>
>
{{ $t("languages." + item) }}
</div>
</div>
<div class="bar">
<div class="bar-btn" @click="onclickMinimise">{{ $t("topbar.minimise") }}</div>
<div class="bar-btn" @click="onclickMinimise">
{{ $t("topbar.minimise") }}
</div>
<div class="bar-btn" @click="onclickQuit">{{ $t("topbar.quit") }}</div>
</div>
</div>
Expand All @@ -34,54 +38,46 @@
</template>

<script>
import { ref, watch } from 'vue'
import { ref, watch } from "vue";
import i18n from "@/i18n";
export default {
setup() {
// List of supported languages
// 支持的语言列表
const languages = i18n.global.availableLocales
const languages = i18n.global.availableLocales;
// Current language
// 当前语言
const locale = ref("zh-Hans")
locale.value = i18n.global.locale
const locale = ref("zh-Hans");
locale.value = i18n.global.locale;
// Click to switch language
// 点击切换语言
const onclickLanguageHandle = (item) => {
(item !== locale.value) ? (locale.value = item) : false
}
item !== locale.value ? (locale.value = item) : false;
};
// Monitor current language changes
// 监听当前语言变动
watch(locale, (newValue, oldValue) => {
console.log('The new language is: ' + locale.value)
i18n.global.locale = newValue
})
i18n.global.locale = newValue;
});
// Since the current js runtime has not been developed yet, so first call Go to complete. Later,
// it will be updated to be called directly when js is running.
// 由于当前js运行时还没有开发完成,所以先调用Go完成。后续会更新为js运行时直接调用。
const onclickMinimise = () => {
window.runtime.WindowMinimise()
}
window.runtime.WindowMinimise();
};
const onclickQuit = () => {
window.runtime.Quit()
}
window.runtime.Quit();
};
return {
languages,
locale,
onclickLanguageHandle,
onclickMinimise,
onclickQuit
}
onclickQuit,
};
},
}
};
</script>

<style lang="scss">
Expand Down

0 comments on commit 5cf9d0f

Please sign in to comment.