2016-11-16 19:56:26 +00:00
< template >
< demo-page label = "Components - Dialog" >
< div slot = "examples" >
2016-11-21 04:34:28 +00:00
< demo-example label = "Default" height = "500" >
2016-11-22 02:37:59 +00:00
< md-dialog-alert
: md - title = "alert.title"
: md - content = "alert.content"
: md - ok - text = "alert.ok"
@ open = "onOpen"
@ close = "onClose"
ref = "dialog1" >
< / md-dialog-alert >
2016-11-16 19:56:26 +00:00
2016-11-22 02:26:10 +00:00
< md-dialog-confirm
: md - title = "confirm.title"
2016-11-22 03:34:29 +00:00
: md - content - html = "confirm.contentHtml"
2016-11-22 02:26:10 +00:00
: md - ok - text = "confirm.ok"
: md - cancel - text = "confirm.cancel"
@ open = "onOpen"
@ close = "onClose"
ref = "dialog2" >
< / md-dialog-confirm >
2016-11-22 03:23:40 +00:00
< md-dialog-prompt
: md - title = "prompt.title"
: md - ok - text = "prompt.ok"
: md - cancel - text = "prompt.cancel"
: md - input - id = "prompt.id"
: md - input - name = "prompt.name"
: md - input - maxlength = "prompt.maxlength"
: md - input - placeholder = "prompt.placeholder"
v - model = "prompt.value"
@ open = "onOpen"
@ close = "onClose"
ref = "dialog3" >
< / md-dialog-prompt >
< md-dialog ref = "dialog4" md -open -from = " # custom " md -close -to = " # custom " >
< md-dialog-title > Lorem ipsum dolor sit amet < / md-dialog-title >
2016-11-22 02:37:59 +00:00
2016-11-22 03:23:40 +00:00
< md-dialog-content > Nemo , nobis necessitatibus ut illo , ducimus ex . < / md-dialog-content >
2016-11-22 02:37:59 +00:00
< md-dialog-actions >
2016-11-22 03:23:40 +00:00
< md-button class = "md-primary" @click ="closeDialog('dialog4')" > Cancel < / md -button >
< md-button class = "md-primary" @click ="closeDialog('dialog4')" > Ok < / md -button >
2016-11-22 02:37:59 +00:00
< / md-dialog-actions >
< / md-dialog >
2016-11-22 03:23:40 +00:00
< md-dialog md -open -from = " # fab " md -close -to = " # fab " ref = "dialog5" >
2016-11-22 02:26:10 +00:00
< md-dialog-title > Create new note < / md-dialog-title >
2016-11-22 00:30:32 +00:00
2016-11-22 02:26:10 +00:00
< md-dialog-content >
2016-11-17 05:08:40 +00:00
< form >
< md-input-container >
2016-11-22 00:30:32 +00:00
< label > Note < / label >
< md-textarea > < / md-textarea >
2016-11-17 05:08:40 +00:00
< / md-input-container >
< / form >
2016-11-22 00:30:32 +00:00
< / md-dialog-content >
2016-11-17 05:08:40 +00:00
2016-11-22 00:30:32 +00:00
< md-dialog-actions >
2016-11-22 02:37:59 +00:00
< md-button class = "md-primary" @click ="closeDialog('dialog5')" > Cancel < / md -button >
< md-button class = "md-primary" @click ="closeDialog('dialog5')" > Create < / md -button >
2016-11-22 00:30:32 +00:00
< / md-dialog-actions >
2016-11-17 05:08:40 +00:00
< / md-dialog >
2016-11-22 02:37:59 +00:00
< md-button class = "md-primary md-raised" @click ="openDialog('dialog1')" > Alert < / md -button >
2016-11-22 02:26:10 +00:00
< md-button class = "md-primary md-raised" @click ="openDialog('dialog2')" > Confirm < / md -button >
2016-11-22 02:37:59 +00:00
< md-button class = "md-primary md-raised" @click ="openDialog('dialog3')" > Prompt < / md -button >
2016-11-22 03:23:40 +00:00
< md-button class = "md-primary md-raised" id = "custom" @click ="openDialog('dialog4')" > Custom < / md -button >
< md-button class = "md-fab md-fab-bottom-right" id = "fab" @click ="openDialog('dialog5')" >
2016-11-22 00:30:32 +00:00
< md-icon > add < / md-icon >
2016-11-21 04:34:28 +00:00
< / md-button >
2016-11-22 03:23:40 +00:00
< div > Prompt Name : { { prompt . value } } < / div >
2016-11-16 19:56:26 +00:00
< / demo-example >
< / div >
< div slot = "code" >
< demo-example label = "Default" >
< code-block lang = "xml" >
< / code-block >
< / demo-example >
< / div >
< div slot = "api" >
< / div >
< / demo-page >
< / template >
< style lang = "scss" scoped >
< / style >
< script >
export default {
2016-11-22 02:26:10 +00:00
data : ( ) => ( {
2016-11-22 03:23:40 +00:00
alert : {
content : 'Your post has been deleted!' ,
ok : 'Cool!'
} ,
2016-11-22 02:26:10 +00:00
confirm : {
title : 'Use Google\'s location service?' ,
2016-11-22 03:34:29 +00:00
contentHtml : 'Let Google help apps determine location. <br> This means sending <strong>anonymous</strong> location data to Google, even when no apps are running.' ,
2016-11-22 02:26:10 +00:00
ok : 'Agree' ,
cancel : 'Disagree'
2016-11-22 02:37:59 +00:00
} ,
2016-11-22 03:23:40 +00:00
prompt : {
title : 'What\'s your name?' ,
ok : 'Done' ,
cancel : 'Cancel' ,
id : 'name' ,
name : 'name' ,
placeholder : 'Type your name...' ,
maxlength : 30 ,
value : ''
2016-11-22 02:26:10 +00:00
}
} ) ,
2016-11-16 19:56:26 +00:00
methods : {
2016-11-17 05:08:40 +00:00
openDialog ( ref ) {
this . $refs [ ref ] . open ( ) ;
2016-11-16 19:56:26 +00:00
} ,
2016-11-17 05:08:40 +00:00
closeDialog ( ref ) {
this . $refs [ ref ] . close ( ) ;
2016-11-22 02:26:10 +00:00
} ,
onOpen ( ) {
console . log ( 'Opened' ) ;
} ,
onClose ( type ) {
console . log ( 'Closed' , type ) ;
2016-11-16 19:56:26 +00:00
}
}
} ;
< / script >