# Message全局提示

全局展示操作反馈信息。

## 何时使用

* 可提供成功、警告和错误等反馈信息。
* 顶部居中显示并自动消失，是一种不打断用户操作的轻量级提示方式。

### 不同状态

::: demo 信息提醒反馈。

```html
<template>
    <div>

        <ut-button type='success' @click.native='openSuccess'>success</ut-button>

        <ut-button type='info' @click.native='openInfo'>info</ut-button>

        <ut-button type='warning' @click.native='openWarning'>warning</ut-button>

        <ut-button type='danger' @click.native='openDanger'>error</ut-button>

    </div>
</template>
<script lang="babel">
    export default{
        methods: {
            openSuccess(){
                this.$message({
                    type: 'success',
                    message: '发送成功',
                    duration:0
                })
            },
            openInfo(){
                this.$message('发送成功');
            },
            openWarning(){
                this.$message.warning('这是一条警告');
            },
            openDanger(){
                this.$message.error('对方不想跟你说话并向你抛出一个异常');
            }
        }
    }
</script>
```
:::


### 显示时间

::: demo 信息提醒反馈。
```html
<template>
      <ut-button type='success' plain @click.native='duration(3000)'>打开后3s关闭</ut-button>
</template>
<script lang="babel">
    export default{
        methods: {
            duration(time){
                this.$message({
                     type: 'success',
                     message: '打开3s',
                     duration:time
                })
            }
        }
    }
</script>
```
:::


<script lang="babel">
    export default{
        methods: {
            openSuccess(){
                this.$message({
                    type: 'success',
                    message: '发送成功',
                    duration:0
                })
            },
            openInfo(){
                this.$message('发送成功');
            },
            openWarning(){
                this.$message.warning('这是一条警告');
            },
            openDanger(){
                this.$message.error('对方不想跟你说话并向你抛出一个异常');
            },
            duration(time){
                 this.$message({
                      type: 'success',
                      message: '打开3s',
                      duration:time
                 })
            }           
        }
    }
</script>