Skip to content

Button ボタン ​

基本的なボタンコンポーネントです。レンダリングは uni 内蔵の <button>(各端のネイティブボタンにコンパイルされます)で行い、クリックイベントは uni が bindtap にコンパイルします。

基本的な使い方 ​

vue
<template>
  <lh-button>デフォルト</lh-button>
  <lh-button type="primary">プライマリ</lh-button>
  <lh-button type="success">成功</lh-button>
  <lh-button type="warning">警告</lh-button>
  <lh-button type="danger">危険</lh-button>
  <lh-button type="info">情報</lh-button>
</template>

状態と形状 ​

vue
<template>
  <lh-button loading>読み込み中</lh-button>
  <lh-button disabled>無効</lh-button>
  <lh-button plain>プレーン</lh-button>
  <lh-button round>角丸</lh-button>
  <lh-button circle icon="search" />
  <lh-button block>ブロック(1 行を占有)</lh-button>
  <lh-button icon="search" type="primary">アイコン付き</lh-button>
</template>

Props ​

プロパティ説明型デフォルト値
typeタイプ'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info''default'
sizeサイズ。渡さない場合は ConfigProvider から継承'small' | 'medium' | 'large'—
loading読み込み中状態booleanfalse
disabled無効booleanfalse
plainプレーン(アウトライン)スタイルbooleanfalse
blockブロックレイアウトbooleanfalse
round角丸booleanfalse
circle円形booleanfalse
iconアイコン名LhIconName—
customClassカスタムクラス名(ルートノードに透過)string—
themeVarsコンポーネントレベルのテーマ変数Record<string, string>—
bgPatternコンポーネントレベルの背景紋様string—
sxクイックレイアウトプロパティLhSxProps—

Events ​

イベント説明コールバックパラメータ
clickクリック(event)

Vue3 版との差異

ミニプログラムの button には nativeType / href / target のセマンティクスがないため、この 3 つのプロパティは本ライブラリでは実装しません。 その他の API は同じです。