Button按钮
# 基础用法
<template>
<div class="t-basic-button-area">
<div>
<as-button>默认按钮</as-button>
<as-button type="primary">主要按钮</as-button>
<as-button type="success">成功按钮</as-button>
<as-button type="info">信息按钮</as-button>
<as-button type="warning">警告按钮</as-button>
<as-button type="danger">危险按钮</as-button>
</div>
<div>
<as-button plain>朴素按钮</as-button>
<as-button type="primary" plain>主要按钮</as-button>
<as-button type="success" plain>成功按钮</as-button>
<as-button type="info" plain>信息按钮</as-button>
<as-button type="warning" plain>警告按钮</as-button>
<as-button type="danger" plain>危险按钮</as-button>
</div>
<div>
<as-button round>圆角按钮</as-button>
<as-button type="primary" round>主要按钮</as-button>
<as-button type="success" round>成功按钮</as-button>
<as-button type="info" round>信息按钮</as-button>
<as-button type="warning" round>警告按钮</as-button>
<as-button type="danger" round>危险按钮</as-button>
</div>
<div class="icon-area">
<as-button icon="as-icon-search" circle></as-button>
<as-button type="primary" icon="as-icon-edit" circle></as-button>
<as-button type="success" icon="as-icon-check" circle></as-button>
<as-button type="info" icon="as-icon-message" circle></as-button>
<as-button type="warning" icon="as-icon-star-off" circle></as-button>
<as-button type="danger" icon="as-icon-delete" circle></as-button>
</div>
</div>
</template>
<script>
export default {
name: "t-basic-button"
}
</script>
<style>
.t-basic-button-area>div{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
margin-top: 20px;
margin-bottom: 20px;
}
.t-basic-button-area .as-button{
margin-top: 10px;
margin-right: 10px;
}
</style>
Expand Copy Copy
# 禁用状态
<template>
<div class="t-disabled-button-area">
<div>
<as-button disabled>默认按钮</as-button>
<as-button type="primary" disabled>主要按钮</as-button>
<as-button type="success" disabled>成功按钮</as-button>
<as-button type="info" disabled>信息按钮</as-button>
<as-button type="warning" disabled>警告按钮</as-button>
<as-button type="danger" disabled>危险按钮</as-button>
</div>
<div>
<as-button plain disabled>朴素按钮</as-button>
<as-button type="primary" plain disabled>主要按钮</as-button>
<as-button type="success" plain disabled>成功按钮</as-button>
<as-button type="info" plain disabled>信息按钮</as-button>
<as-button type="warning" plain disabled>警告按钮</as-button>
<as-button type="danger" plain disabled>危险按钮</as-button>
</div>
</div>
</template>
<script>
export default {
name: "t-disabled-button"
}
</script>
<style>
.t-disabled-button-area>div{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
margin-top: 20px;
margin-bottom: 20px;
}
.t-disabled-button-area .as-button{
margin-top: 10px;
margin-right: 10px;
}
</style>
Expand Copy Copy
# 文字按钮
<template>
<div>
<as-button type="text">文字按钮</as-button>
<as-button type="text" disabled>文字按钮</as-button>
</div>
</template>
<script>
export default {
name: "t-disabled-button"
}
</script>
<style>
</style>
Expand Copy Copy
# 图标按钮
<template>
<div class="t-icon-button-area">
<as-button type="primary" icon="as-icon-edit"></as-button>
<as-button type="primary" icon="as-icon-share"></as-button>
<as-button type="primary" icon="as-icon-delete"></as-button>
<as-button type="primary" icon="as-icon-search">搜索</as-button>
<as-button type="primary">上传<i class="as-icon-upload as-icon--right"></i></as-button>
</div>
</template>
<script>
export default {
name: "t-icon-button"
}
</script>
<style>
.t-icon-button-area{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
}
.t-icon-button-area .as-button{
margin-right: 10px;
margin-top: 10px;
}
</style>
Expand Copy Copy
# 按钮组
<template>
<div class="t-button-group-area">
<as-button-group>
<as-button type="primary" icon="el-icon-arrow-left">后退</as-button>
<as-button type="primary">前进<i class="el-icon-arrow-right el-icon--right"></i></as-button>
</as-button-group>
</div>
</template>
<script>
export default {
name: "t-button-group"
}
</script>
<style>
.t-button-group-area{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
}
</style>
Expand Copy Copy
# 加载中
<template>
<div class="t-loading-button-area">
<as-button type="primary" :loading="true">加载中</as-button>
</div>
</template>
<script>
export default {
name: "t-loading-button"
}
</script>
<style>
.t-loading-button-area{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
}
</style>
Expand Copy Copy
# 不同尺寸
<template>
<div class="t-size-button-area">
<div>
<as-button>默认按钮</as-button>
<as-button size="medium">中等按钮</as-button>
<as-button size="small">小型按钮</as-button>
<as-button size="mini">超小按钮</as-button>
</div>
<div>
<as-button round>默认按钮</as-button>
<as-button size="medium" round>中等按钮</as-button>
<as-button size="small" round>小型按钮</as-button>
<as-button size="mini" round>超小按钮</as-button>
</div>
</div>
</template>
<script>
export default {
name: "t-button-group"
}
</script>
<style>
.t-size-button-area>div{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
margin-top: 10px;
margin-bottom: 10px;
}
.t-size-button-area .as-button{
margin-top: 10px;
margin-right: 10px;
}
</style>
Expand Copy Copy
# Attributes
参数 | 默认值 | 说明 |
---|---|---|
size | -- | 尺寸,类型为String,可选值为medium/small/mini |
type | -- | 类型 ,类型为String,可选值为primary/success/warning/danger/info/text |
plain | false | 是否朴素按钮,类型为Boolean |
round | false | 是否圆角按钮,类型为Boolean |
circle | false | 是否圆形按钮,类型为Boolean |
loading | false | 是否加载中状态,类型为Boolean |
icon | -- | 图标类名,类型为String |
disabled | false | 是否禁用状态,类型为Boolean |
autofocus | false | 是否默认聚焦,类型为Boolean |
native-type | button | 原生type属性,类型为String,可选值为button/submit/reset |