/
githubmirror
/
halo
Обзор
Документация
Войти
/
githubmirror
/
halo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
ui/src/components/button/SubmitButton.vue
45 строк
916 B
Ryan Wang
Switch formatter from Prettier to oxfmt (#8381)
03 мар 2026, 06:39
Не верифицирован
03 мар 2026, 06:39
da45e16
Код
Авторство
О чём код?
<script lang="ts" setup> import { VButton } from "@halo-dev/components"; import { useMagicKeys } from "@vueuse/core"; import { computed, useAttrs, watchEffect } from "vue"; import { useI18n } from "vue-i18n"; import { isMac } from "@/utils/device"; const { t } = useI18n(); const props = withDefaults( defineProps<{ text?: string; }>(), { text: "提交", } ); const emit = defineEmits<{ (event: "submit"): void; }>(); const attrs = useAttrs(); const buttonText = computed(() => { return t("core.components.submit_button.computed_text", { text: props.text, shortcut: `${isMac ? "⌘" : "Ctrl"} + ↵`, }); }); const { Command_Enter, Ctrl_Enter } = useMagicKeys(); watchEffect(() => { if (Command_Enter.value || Ctrl_Enter.value) { emit("submit"); } }); </script> <template> <VButton v-bind="attrs" @click="emit('submit')"> {{ buttonText }} </VButton> </template>