# Message 提示
# 概述
重量级的信息反馈组件,在屏幕中间显示,显示少量内容,给予提示,需要用户确认。
# 代码示例
# API
提供了静态方法,在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
this.$Message.confirm("标题", "我是提示").then(function (index) {
console.log(index)
})
# Options
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
title | 标题,内容可以是字符串和包含Dom结构的字符串 | String | null |
template | 提示内容,内容可以是字符串和包含Dom结构的字符串 | String | null |
buttons | 配置按钮的数据,最多两个,多余的不显示 | Array | [] |
buttons.text | 按钮文字 | String | null |
buttons.show | 按钮是否显示 | Boolean | true |
buttons.class | 按钮的样式 | String | null |
← Toast 全局提示 Modal 模态框 →