# Notify 消息提示

# 介绍

在页面顶部展示消息提示,支持函数调用和组件调用两种方式。

# 引入

app.jsonindex.json中引入组件

"usingComponents": {
  "s-notify": "@sanqi377/qui/s-notify/"
}
Notify 组件主要依靠 JavaScript 主动调用,所以只需在 wxml 中添加一个组件,并设置 id,其余配置在 .js 里完成。如果只有一个 Notify 组件,建议将 id 设置为 #notify selector 属性来指定。

# 代码演示

<view bindtap="handleDefault">默认提醒</view>

<s-notify id="notify" />
const { $Notify } = require('@sanqi377/qui/s-notify/notify')

Page({
    handleDefault () {
        $Notify({
            type: 'success',
            content: '这是一条普通提醒'
        })
    }
})

# Options

属性 说明 类型 默认值
content 内容 String -
type 指定警告提示的样式,有四种选择 defaultsuccesswarningerror String default
duration 持续时间,单位秒 Number 2
selector 组件标识 String #notify
Last Updated: 8/22/2021, 10:45:45 PM