For AI agents: the complete documentation index is available at https://payhon.github.io/AppKernia/llms.txt, the full documentation bundle is available at https://payhon.github.io/AppKernia/llms-full.txt, and this page is available as Markdown at https://payhon.github.io/AppKernia/mobile-components/button.md.

ak-button

用于主操作、次操作与危险操作。最小高度 44px;loadingdisabled 时不会触发 click

<ak-button
  variant="primary"
  :loading="saving"
  :disabled="!canSubmit"
  :loading-text="t('common.status.saving')"
  :label="t('common.actions.save')"
  @click="submit"
/>

也可以用默认 slot:

<ak-button variant="secondary" @click="cancel">
  {{ t('common.actions.cancel') }}
</ak-button>

Props

属性类型默认值说明
variantStringprimaryprimarysecondarydanger;其他值回退到 primary
loadingBooleanfalse展示 loadingText 并阻止点击
disabledBooleanfalse降低透明度并阻止点击
loadingTextString''加载文案,应传入翻译结果
labelString''非空时优先于默认 slot

Events

事件参数说明
click仅在非 loading 且非 disabled 时触发

使用建议

  • 一组操作只保留一个 primary。
  • 不用 danger 表达普通取消;危险操作还需要明确确认与后果说明。
  • 网络请求期间保持 loading=true,防止重复提交。