@skit/wepy2-com-toast
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

wepy2-com-toast

一个 toast 消息框组件。

此组件依赖 wepy 2.0.0+。

如果你正在使用 wepy 1.x,请移步 wepy-com-toast


用法

安装:

npm install @skit/wepy2-com-toast --save

导入:

<template>
    <ui-toast ref="toast" />
</template>
<config>
{
    usingComponents: {
        'ui-toast': 'module:@skit/wepy2-com-toast'
    }
}
</config>
<script>
    import Wepy from 'wepy';

    Wepy.page({
        onShow() {
            this.$refs['toast'].show('hello world');
        }
    });
</script>

注意:当前版本的 wepy-cli 存在 Bug,无法打包通过 node_modules 引入的 wpy 组件,解决方案请参考 Issue#2554

可配置项

属性:

方法:

/**
 * 显示消息对话框。
 * @param {Object} options 配置项。
 * @param {String} options.content 提示文本。
 * @param {String} options.position 对话框出现在屏幕的位置,支持“top”、“center”、“bottom”,默认值为“bottom”。
 * @param {String} options.duration 指定对话框若干毫秒后自动消失,默认值为“2000”。
 */
this.$refs['toast'].show({
    content: '这是一条消息',
    position: 'center',
    duration: 3000
});

/**
 * 显示消息对话框。
 * @param {String} content 消息文本。
 */
this.$refs['toast'].show('这是一条消息');

/**
 * 隐藏消息对话框。
 */
this.$refs['toast'].hide();

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    0

Package Sidebar

Install

npm i @skit/wepy2-com-toast

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

7.51 kB

Total Files

5

Last publish

Collaborators

  • fudiwei