Message 提示
概述
重量级的信息反馈组件,在屏幕中间显示,显示少量内容,给予提示,需要用户确认。
代码示例
|
只显示内容
显示标题和内容
|
|
|
alert模式
confirm模式
alert模式只有确认按钮,confirm模式有确认和取消按钮。
|
|
|
可配置的Message
传入配置对象,可以配置标题、内容、按钮文字
标题和内容支持传入html
|
|
API
Message instance
通过直接在vue实例里面调用以下方法来使用组件
- this.$Message(title, template) | this.$Message(option)
- this.$Message.success(title, template) | this.$Message.success(option)
- this.$Message.error(title, template) | this.$Message.error(option)
- this.$Message.warn(title, template) | this.$Message.warn(option)
- 返回值是promise,当点击按钮时触发resolve,参数是按钮的index
|
属性
|
说明
|
类型
|
默认值
|
|
title
|
标题
|
String
|
null
|
|
template
|
提示内容
|
String
|
null
|
|
buttons
|
配置按钮的数据,最多两个,多余的不显示
|
Array
|
[]
|
|
buttons.text
|
按钮文字
|
String
|
null
|
|
buttons.show
|
按钮是否显示
|
Boolean
|
true
|
|
buttons.class
|
按钮的样式
|
String
|
null
|