Skip to content
官方QQ交流群
pc端ui:468705115   点此加入
移动端ui:468217742   点此加入
技术交流1:87208295   点此加入
技术交流2:787747122   点此加入
官网
云控制台
开放平台
关注微信公众号
代码仓库: 码云

Alert 警告提示

警告提示,展现需要关注的信息。

使用场景

  • 当某个页面需要向用户显示警告的信息时。
  • 非浮层的静态展现形式,始终展现,不会自动消失,用户可以点击关闭。

平台差异说明

App(vue)App(nvue)H5小程序

基本使用

  • 通过titledescription设置组件的标题和描述内容
  • 通过type设置主题类型,有primary,success,error,warning,info可选值
  • 通过effect设置主题浅或深色调,有light(浅色 默认),dark(深色)可选值
html
<template>
	<view>
		<up-alert :title="title" type = "warning" :description = "description"></up-alert>
		<up-alert :title="title" type = "warning" effect="dark" :description = "description"></up-alert>
	</view>
</template>

<script>
export default {
	data() {
		return {
			title:'uView的目标是成为uni-app生态最优秀的UI框架',
			description:'uView是uni-app生态专用的UI框架'
		};
	},
	onLoad() {},
	methods: {
	}
};
</script>

图标

通过showIcon设置是否显示图标,作用是让信息类型更加醒目。

注意:当前版本图标为uView内置图标,根据type参数显示不同的图标,无法自定义。

html
<up-alert type="warning" :show-icon="true"></up-alert>

可关闭的警告提示

显示关闭按钮,点击可关闭警告提示。

  • closable参数配置是否可关闭
html
<template>
	<view>
		<up-alert :title="title"  type = "warning" :closable="closable" :description = "description"></up-alert>
	
	</view>
</template>

<script>
export default {
	data() {
		return {
			title:'uView的目标是成为uni-app生态最优秀的UI框架',
			description:'uView是uni-app生态专用的UI框架',
			closable:true
		};
	},
	onLoad() {},
	methods: {
	}
};
</script>

此页面源代码地址

页面源码地址


 github  gitee

API

Props

参数说明类型默认值可选值
title显示的文字String--
type使用预设的颜色Stringwarningsuccess | primary | error | info
description辅助性文字,颜色比title浅一点,字号也小一点,可选String--
closable关闭按钮(默认为叉号icon图标)Booleanfalsetrue
showIcon是否显示左边的辅助图标Booleanfalsetrue
effect多图时,图片缩放裁剪的模式Stringlight(浅色)dark(深色)
center文字是否居中Booleanfalsetrue
fontSize字体大小String | Number14-

Events

事件名说明回调参数
click点击组件时触发-

Copyright © 2017 10yun.com | 十云提供计算服务-IPV6 | ctocode组开发