2.0.25 • Published 2 years ago

@eightfeet/message v2.0.25

Weekly downloads
3
License
ISC
Repository
-
Last release
2 years ago

Message

弱提示模块,需要promise polyfill demo

npm i @eightfeet/message -S
import Message from '@eightfeet/message';

const myMessage = new Message();

myMessage.create('A message!').then(() => console.log('已经完成弱提示'));

parame

参数说明是否必填备注类型
id所创建弱提示的id不传可自动生成id(message + 时间戳 + 100以内的随机数)String
zIndexmessage的样式层级关系默认10000Number
emBaseem单位的基准像素默认自动计算(emBase = document.clientWidth/24)Number
parentId所挂载的父级ID用于做局部弱提示默认挂在body下面,指定父级dom时将挂载在父级dom下,配合css实现局部弱提示String
directionFrom入场方向top,bottom。默认topString
style定义弱提示样式{ wrap: 外包裹 main: 弱提示内容}Object

options

  1. create: ƒ (content, time, noRemoval) 创建message

    content String 提示内容。

    time Number 提示保留时间

    noRemoval Boolean 关闭弹窗时是否移除message Dom。 false移除,true保留。

  2. hide: ƒ (noRemoval) 隐藏弹窗

    noRemoval Boolean 关闭弹窗时是否移除弹窗Dom。 false移除,true保留。

  3. remove: ƒ () 移除弹窗

    移除,将message从body中移除。

  4. show: ƒ (content) 显示弹窗

    显示页面Message,如果创建的Message是隐藏而不是移除时,调用此方法显示Message。 content String 提示内容。

case

import Modal from '@eightfeet/Message';

const newMessage = new Message({
        directionFrom: 'top', // 底部位置
        style: { 
            wrap: {
                top: 'auto'
            },
            main: {
                backgroundColor: 'red'
            }
        }
    });

    const btn = document.getElementById('exampleBtn');

    btn.onclick = function(){ 
        return newMessage.create('Message', null, true).then(function(){
            document.getElementById('btnShow').onclick = function(){
                return newMessage.show('显示已存在的Message!');
            };
        });
    }
    
2.0.24

2 years ago

2.0.25

2 years ago

2.0.23

2 years ago

2.0.22

3 years ago

2.0.20

3 years ago

2.0.21

3 years ago

2.0.15

3 years ago

2.0.16

3 years ago

2.0.13

3 years ago

2.0.14

3 years ago

2.0.11

3 years ago

2.0.12

3 years ago

2.0.9

3 years ago

2.0.10

3 years ago

2.0.8

3 years ago

2.0.19

3 years ago

2.0.17

3 years ago

2.0.18

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.3

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago