Alert警告
# 基础用法
<template>
<div class="t-basic-alert-area">
<as-alert
title="成功提示的文案"
type="success">
</as-alert>
<as-alert
title="消息提示的文案"
type="info">
</as-alert>
<as-alert
title="警告提示的文案"
type="warning">
</as-alert>
<as-alert
title="错误提示的文案"
type="error">
</as-alert>
</div>
</template>
<script>
export default {
name: "t-basic-alert"
}
</script>
<style>
.t-basic-alert-area .as-alert{
margin-bottom: 10px;
}
</style>
Expand Copy Copy
# 主题
<template>
<div class="t-title-alert-area">
<as-alert
title="成功提示的文案"
type="success"
effect="dark">
</as-alert>
<as-alert
title="消息提示的文案"
type="info"
effect="dark">
</as-alert>
<as-alert
title="警告提示的文案"
type="warning"
effect="dark">
</as-alert>
<as-alert
title="错误提示的文案"
type="error"
effect="dark">
</as-alert>
</div>
</template>
<script>
export default {
name: "t-title-alert"
}
</script>
<style>
.t-title-alert-area .as-alert{
margin-bottom: 10px;
}
</style>
Expand Copy Copy
# 自定义关闭按钮
<template>
<div class="t-custom-close-alert-area">
<as-alert
title="不可关闭的 alert"
type="success"
:closable="false">
</as-alert>
<as-alert
title="自定义 close-text"
type="info"
close-text="知道了">
</as-alert>
<as-alert
title="设置了回调的 alert"
type="warning"
@close="hello">
</as-alert>
</div>
</template>
<script>
export default {
name: "t-custom-close-alert",
methods: {
hello() {
alert('Hello World!');
}
}
}
</script>
<style>
.t-custom-close-alert-area .as-alert{
margin-bottom: 10px;
}
</style>
Expand Copy Copy
# 带有icon
<template>
<div class="t-icon-alert-area">
<as-alert
title="成功提示的文案"
type="success"
show-icon>
</as-alert>
<as-alert
title="消息提示的文案"
type="info"
show-icon>
</as-alert>
<as-alert
title="警告提示的文案"
type="warning"
show-icon>
</as-alert>
<as-alert
title="错误提示的文案"
type="error"
show-icon>
</as-alert>
</div>
</template>
<script>
export default {
name: "t-icon-alert"
}
</script>
<style>
.t-icon-alert-area .as-alert{
margin-bottom: 10px;
}
</style>
Expand Copy Copy
# 文字居中
<template>
<div class="t-center-text-alert-area">
<as-alert
title="成功提示的文案"
type="success"
center
show-icon>
</as-alert>
<as-alert
title="消息提示的文案"
type="info"
center
show-icon>
</as-alert>
<as-alert
title="警告提示的文案"
type="warning"
center
show-icon>
</as-alert>
<as-alert
title="错误提示的文案"
type="error"
center
show-icon>
</as-alert>
</div>
</template>
<script>
export default {
name: "t-center-text-alert"
}
</script>
<style>
.t-center-text-alert-area .as-alert{
margin-bottom: 10px;
}
</style>
Expand Copy Copy
# 带有辅助性文字介绍
<template>
<div class="t-description-alert-area">
<as-alert
title="带辅助性文字介绍"
type="success"
description="这是一句绕口令:黑灰化肥会挥发发灰黑化肥挥发;灰黑化肥会挥发发黑灰化肥发挥。 黑灰化肥会挥发发灰黑化肥黑灰挥发化为灰……">
</as-alert>
</div>
</template>
<script>
export default {
name: "t-description-alert"
}
</script>
<style>
</style>
Expand Copy Copy
# 带有icon和辅助性文字介绍
<template>
<div class="t-description-and-icon-alert-area">
<as-alert
title="成功提示的文案"
type="success"
description="文字说明文字说明文字说明文字说明文字说明文字说明"
show-icon>
</as-alert>
<as-alert
title="消息提示的文案"
type="info"
description="文字说明文字说明文字说明文字说明文字说明文字说明"
show-icon>
</as-alert>
<as-alert
title="警告提示的文案"
type="warning"
description="文字说明文字说明文字说明文字说明文字说明文字说明"
show-icon>
</as-alert>
<as-alert
title="错误提示的文案"
type="error"
description="文字说明文字说明文字说明文字说明文字说明文字说明"
show-icon>
</as-alert>
</div>
</template>
<script>
export default {
name: "t-description-and-icon-alert"
}
</script>
<style>
.t-description-and-icon-alert-area .as-alert{
margin-bottom: 10px;
}
</style>
Expand Copy Copy
# Attributes
参数 | 默认值 | 说明 |
---|---|---|
title | -- | 标题,类型为String |
type | info | 主题,类型为String,可选值为success/warning/info/error |
description | -- | 辅助性文字。也可通过默认slot传入,类型为String |
closable | true | 是否可关闭,类型为Boolean |
center | true | 文字是否居中,类型为Boolean |
close-text | -- | 关闭按钮自定义文本,类型为String |
show-icon | false | 是否显示图标,类型为Boolean |
effect | light | 选择提供的主题,类型为String,可选值为light/dark |
# Slot
名称 | 说明 |
---|---|
-- | 描述 |
title | 标题的内容 |
# Events
事件名称 | 说明 | 回调参数 |
---|---|---|
close | 关闭alert时触发的事件 | -- |
← Statistic统计数值 Card卡片 →