2.3.12 • Published 5 years ago

nuke-modal v2.3.12

Weekly downloads
162
License
Apache-2.0
Repository
gitlab
Last release
5 years ago

Modal

  • category: UI
  • chinese: 模态框
  • type: UI Component

Design

This component calls weex modal component to show alerts, confirms, prompts, and in web environment use window.alert, window.confirm, window.prompt.

In app weex page, normally it would show system dialogs, but your app may overwrite modal code and use app customized app dialogs instead.

If this component cannot satisfy your popup layout needs, you can also check Dialog component and customize your own style.

Notice Modal component only accept String type contents , Modal.alert(jsArray) may cause serious issues.

API

Modal.alert

PropsDescriptionTypeDefault
titletitlestringnull
callbackorArraycallbacks or button optionsfunction or arraynull
// simple
Modal.alert("Hello World") 

//callBack
Modal.alert("Hello World",(e)=>{ console.log(e)}) 

//set the button content
Modal.alert("Hello World",[ 
    {
        onPress:(e)=>{console.log(e)},
        text:"Confirm按钮"
    }
])

Modal.confirm

| Props | Description | Type | Default | | | --------------- ---------- | ----------- ------ | ------ - | - ------- | | | message | content | string | null | | | callbackorArray | callbacks or button options | function or array | null | |

// simple
Modal.confirm("Hello World") 

//focus on the simple writing of the callback 
Modal.confirm("Hello World",()=>{ console.log('点击了Confirm')}) 

//focus on the callback, and set button content
Modal.confirm("Hello World",[ 
    {
        onPress:()=>{console.log('点击了Confirm')},
        text:"Confirm"
    }
])

//confirm, or cancel, you can set the button content
Modal.confirm('给个评价吧!!',[ 
    {
        onPress:()=>{console.log('点击了去看看')},
        text:"去看看"
    },
    {
        onPress:()=>{console.log('点击了以后再说')},
        text:"以后再说"
    }
]);

Modal.prompt

PropsDescriptionTypeDefault
messagecontentstringnull
callbackorArraycallbacks or button optionsfunction or arraynull
//focus on the simple writing of the callback
Modal.prompt("请填写你的工号:",(e)=>{ console.log(e)}) 

//focus on the callback, and set button content
Modal.prompt("Hello World",[ 
    {
        onPress:(e)=>{console.log(e)},
        text:"Confirm"
    }
])

//confirm, or cancel, you can set the button content
Modal.prompt('请填写你的工号:',[ 
    {
        onPress:(e)=>{console.log(e)},
        text:"确认了"
    },
    {
        onPress:()=>{console.log('点击了取消')},
        text:"取消"
    }
]);

Modal.toast

PropsDescriptionTypeDefault
messagecontentstringnull
durationdurationthere are SHORT 2s, LONG 3.5s; for choiceSHORT
//simple writing, duration default values is 'SHORT'
Modal.toast('Hi');

//3.5s
Modal.toast('Hi','LONG');
2.3.12

5 years ago

2.3.11

5 years ago

2.3.10

5 years ago

2.3.8

5 years ago

2.3.7

5 years ago

2.3.6

5 years ago

2.3.5

5 years ago

2.3.4

5 years ago

2.3.3

5 years ago

2.3.2

5 years ago

2.3.0

6 years ago

2.2.29

6 years ago

2.2.28

6 years ago

2.2.26

6 years ago

2.2.24

6 years ago

2.2.23

6 years ago

2.2.21

6 years ago

2.2.19

6 years ago

2.2.18

6 years ago

2.2.17

6 years ago

2.2.16

6 years ago

2.2.14

6 years ago

2.2.13

6 years ago

2.2.11

6 years ago

2.2.10

6 years ago

2.2.8

6 years ago

2.2.7

6 years ago

2.2.6

6 years ago

2.2.4

6 years ago

2.2.3

6 years ago

2.2.2

6 years ago

2.1.10

6 years ago

2.1.6

6 years ago

2.1.4

6 years ago

2.1.3

6 years ago

2.1.1-4.3

6 years ago

2.1.1-3

6 years ago

0.3.7

6 years ago

0.3.6

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.1

6 years ago

1.0.0

7 years ago

0.3.5

7 years ago

0.3.4

7 years ago

0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.6

7 years ago

0.2.5

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

8 years ago

0.0.6

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago