vue-material/docs/src/pages/components/Dialog.vue

111 lines
3.5 KiB
Vue
Raw Normal View History

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"
:md-content="confirm.content"
:md-ok-text="confirm.ok"
:md-cancel-text="confirm.cancel"
@open="onOpen"
@close="onClose"
ref="dialog2">
</md-dialog-confirm>
2016-11-22 02:37:59 +00:00
<md-dialog ref="dialog4">
<md-dialog-title>Use Google's location service?</md-dialog-title>
<md-dialog-content>Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running.</md-dialog-content>
<md-dialog-actions>
<md-button class="md-primary" @click="closeDialog('dialog4')">Disagree</md-button>
<md-button class="md-primary" @click="closeDialog('dialog4')">Agree</md-button>
</md-dialog-actions>
</md-dialog>
<md-dialog md-open-from="#trigger" md-close-to="#trigger" 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>
<form>
<md-input-container>
2016-11-22 00:30:32 +00:00
<label>Note</label>
<md-textarea></md-textarea>
</md-input-container>
</form>
2016-11-22 00:30:32 +00:00
</md-dialog-content>
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>
</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>
<md-button class="md-primary md-raised" @click="openDialog('dialog4')">Simple</md-button>
<md-button class="md-fab md-fab-bottom-right" id="trigger" @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-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: () => ({
confirm: {
title: 'Use Google\'s location service?',
content: 'Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running.',
ok: 'Agree',
cancel: 'Disagree'
2016-11-22 02:37:59 +00:00
},
alert: {
title: 'Use Google\'s location service?',
content: 'Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running.',
ok: 'Got it!'
2016-11-22 02:26:10 +00:00
}
}),
2016-11-16 19:56:26 +00:00
methods: {
openDialog(ref) {
this.$refs[ref].open();
2016-11-16 19:56:26 +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>