按钮 Button

基本

  1. <za-button ghost>default</za-button>
  2. <za-button theme="primary">primary</za-button>

块级按钮

  1. <za-button block ghost @click="handleClick">default</za-button>
  2. <za-button block ghost disabled @click="handleClick">default disabled</za-button>
  3. <za-button theme="primary" block>primary</za-button>
  4. <za-button theme="primary" block disabled>primary disabled</za-button>

按钮主题

  1. <za-button ghost>default</za-button>
  2. <za-button theme="primary">primary</za-button>
  3. <za-button theme="danger">danger</za-button>

按钮大小

  1. <za-button ghost size="lg">lg</za-button>
  2. <za-button ghost>md</za-button>
  3. <za-button ghost size="sm">sm</za-button>
  4. <za-button ghost size="xs">xs</za-button>

按钮形状

  1. <za-panel-body>
  2. <za-button theme="primary">rect</za-button>
  3. <za-button theme="primary" shape="radius">radius</za-button>
  4. <za-button theme="primary" shape="round">round</za-button>
  5. <za-button theme="primary" shape="circle">circle</za-button>
  6. <za-button shape="circle" ghost>
  7. <za-icon type="right" slot="icon"></za-icon>
  8. </za-button>
  9. </za-panel-body>

带 icon 的按钮

  1. <za-button ghost shape="radius">
  2. <za-icon type="right-round" theme="success" slot="icon"></za-icon>
  3. 正确
  4. </za-button>
  5. <za-button ghost shape="radius">
  6. <za-icon type="wrong-round" theme="error" slot="icon"></za-icon>
  7. 错误
  8. </za-button>
  9. <za-button ghost loading shape="radius">
  10. 加载中
  11. </za-button>

幽灵按钮

<za-button block ghost>default ghost</za-button>
<za-button theme="primary" block ghost>primary ghost</za-button>
<za-button theme="danger" block ghost>danger ghost</za-button>

Vue Script

<script name="vue">
export default {
  methods: {
    handleClick(n){
      console.log(n);
      alert('点击了我...');
    },
  },
};
</script>

API

Button Attributes

属性类型默认值可选值/参数说明
themestring'default''default', 'primary', 'danger'主题
sizestring'xl', 'lg', 'sm', 'xs'大小
shapestring'radius', 'round', 'circle'形状
blockbooleanfalse是否为块级元素
ghostbooleanfalse是否是幽灵按钮
disabledbooleanfalse是否禁用
loadingbooleanfalse是否显示加载中

Button Events

事件名称说明回调参数
clickclick 时触发的事件event 事件对象

Button 按钮 - 图1