# Notify 消息提示
# 介绍
在页面顶部展示消息提示,支持函数调用和组件调用两种方式。
# 引入
在
app.json
或index.json
中引入组件
"usingComponents": {
"s-notify": "@sanqi377/qui/s-notify/"
}
如果只有一个 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 | 指定警告提示的样式,有四种选择 default 、success 、warning 、error | String | default |
duration | 持续时间,单位秒 | Number | 2 |
selector | 组件标识 | String | #notify |