mirror of
https://github.com/Hopiu/vue-material.git
synced 2026-05-17 11:41:06 +00:00
190 lines
7.8 KiB
Vue
190 lines
7.8 KiB
Vue
<template>
|
|
<page-content page-title="Components - Snackbar">
|
|
<docs-component>
|
|
<div slot="description">
|
|
<p>Snackbars contain a single line of text directly related to the operation performed. They may contain a text action, but no icons.</p>
|
|
</div>
|
|
|
|
<div slot="api">
|
|
<api-table name="md-snackbar">
|
|
<md-table slot="properties">
|
|
<md-table-header>
|
|
<md-table-row>
|
|
<md-table-head>Name</md-table-head>
|
|
<md-table-head>Type</md-table-head>
|
|
<md-table-head>Description</md-table-head>
|
|
</md-table-row>
|
|
</md-table-header>
|
|
|
|
<md-table-body>
|
|
<md-table-row>
|
|
<md-table-cell>md-position</md-table-cell>
|
|
<md-table-cell><code>String</code></md-table-cell>
|
|
<md-table-cell>Specify which vertical and horizontal position the snackbar will take. Accepts <code>top left</code>|<code>top center</code>|<code>right center</code>|<code>bottom left</code>|<code>bottom center</code>|<code>bottom right</code>. Default: <code>bottom center</code></md-table-cell>
|
|
</md-table-row>
|
|
|
|
<md-table-row>
|
|
<md-table-cell>md-duration</md-table-cell>
|
|
<md-table-cell><code>Number</code></md-table-cell>
|
|
<md-table-cell>The duration visibility in miliseconds. Default: <code>4000</code></md-table-cell>
|
|
</md-table-row>
|
|
</md-table-body>
|
|
</md-table>
|
|
|
|
<md-table slot="events">
|
|
<md-table-header>
|
|
<md-table-row>
|
|
<md-table-head>Name</md-table-head>
|
|
<md-table-head>Value</md-table-head>
|
|
<md-table-head>Description</md-table-head>
|
|
</md-table-row>
|
|
</md-table-header>
|
|
|
|
<md-table-body>
|
|
<md-table-row>
|
|
<md-table-cell>open</md-table-cell>
|
|
<md-table-cell>None</md-table-cell>
|
|
<md-table-cell>Triggered when the snackbar open.</md-table-cell>
|
|
</md-table-row>
|
|
|
|
<md-table-row>
|
|
<md-table-cell>close</md-table-cell>
|
|
<md-table-cell>None</md-table-cell>
|
|
<md-table-cell>Triggered when the snackbar closes.</md-table-cell>
|
|
</md-table-row>
|
|
</md-table-body>
|
|
</md-table>
|
|
|
|
<md-table slot="methods">
|
|
<md-table-header>
|
|
<md-table-row>
|
|
<md-table-head>Name</md-table-head>
|
|
<md-table-head>Description</md-table-head>
|
|
</md-table-row>
|
|
</md-table-header>
|
|
|
|
<md-table-body>
|
|
<md-table-row>
|
|
<md-table-cell>open</md-table-cell>
|
|
<md-table-cell>Opens the Snackbar.</md-table-cell>
|
|
</md-table-row>
|
|
|
|
<md-table-row>
|
|
<md-table-cell>close</md-table-cell>
|
|
<md-table-cell>Closes the Snackbar.</md-table-cell>
|
|
</md-table-row>
|
|
</md-table-body>
|
|
</md-table>
|
|
</api-table>
|
|
</div>
|
|
|
|
<div slot="example">
|
|
<example-box card-title="Default">
|
|
<div slot="demo">
|
|
<form novalidate @submit.stop.prevent="open">
|
|
<div>
|
|
<div class="md-body-2">Vertical</div>
|
|
<md-radio v-model="vertical" id="top" name="snackbar-vertical" md-value="top">top</md-radio>
|
|
<md-radio v-model="vertical" id="bottom" name="snackbar-vertical" md-value="bottom">bottom</md-radio>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="md-body-2">Horizontal</div>
|
|
<md-radio v-model="horizontal" id="left" name="snackbar-horizontal" md-value="left">left</md-radio>
|
|
<md-radio v-model="horizontal" id="center" name="snackbar-horizontal" md-value="center">center</md-radio>
|
|
<md-radio v-model="horizontal" id="right" name="snackbar-horizontal" md-value="right">right</md-radio>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="md-body-2">Delay</div>
|
|
|
|
<md-input-container>
|
|
<md-input type="number" v-model="duration"></md-input>
|
|
</md-input-container>
|
|
</div>
|
|
|
|
<md-button type="submit" class="md-primary md-raised">Open Snackbar</md-button>
|
|
|
|
<md-snackbar :md-position="vertical + ' ' + horizontal" ref="snackbar" :md-duration="duration">
|
|
<span>Connection timeout. Showing limited messages.</span>
|
|
<md-button class="md-accent" md-theme="light-blue" @click.native="$refs.snackbar.close()">Retry</md-button>
|
|
</md-snackbar>
|
|
</form>
|
|
</div>
|
|
|
|
<div slot="code">
|
|
<code-block lang="xml">
|
|
<form novalidate @submit.stop.prevent="open">
|
|
<div>
|
|
<div class="md-body-2">Vertical</div>
|
|
<md-radio v-model="vertical" id="top" name="snackbar-vertical" md-value="top">top</md-radio>
|
|
<md-radio v-model="vertical" id="bottom" name="snackbar-vertical" md-value="bottom">bottom</md-radio>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="md-body-2">Horizontal</div>
|
|
<md-radio v-model="horizontal" id="left" name="snackbar-horizontal" md-value="left">left</md-radio>
|
|
<md-radio v-model="horizontal" id="center" name="snackbar-horizontal" md-value="center">center</md-radio>
|
|
<md-radio v-model="horizontal" id="right" name="snackbar-horizontal" md-value="right">right</md-radio>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="md-body-2">Delay</div>
|
|
|
|
<md-input-container>
|
|
<md-input type="number" v-model="duration"></md-input>
|
|
</md-input-container>
|
|
</div>
|
|
|
|
<md-button type="submit" class="md-primary md-raised">Open Snackbar</md-button>
|
|
|
|
<md-snackbar :md-position="vertical + ' ' + horizontal" ref="snackbar" :md-duration="duration">
|
|
<span>Connection timeout. Showing limited messages.</span>
|
|
<md-button class="md-accent" md-theme="light-blue" @click.native="$refs.snackbar.close()">Retry</md-button>
|
|
</md-snackbar>
|
|
</form>
|
|
</code-block>
|
|
|
|
<code-block lang="javacript">
|
|
export default {
|
|
data: () => ({
|
|
vertical: 'bottom',
|
|
horizontal: 'center',
|
|
duration: 4000
|
|
}),
|
|
methods: {
|
|
open() {
|
|
this.$refs.snackbar.open();
|
|
}
|
|
}
|
|
};
|
|
</code-block>
|
|
</div>
|
|
</example-box>
|
|
</div>
|
|
</docs-component>
|
|
|
|
<md-button class="md-fab md-fab-bottom-right">
|
|
<md-icon>add</md-icon>
|
|
</md-button>
|
|
</page-content>
|
|
</template>
|
|
|
|
<style lang="sass" scoped>
|
|
|
|
</style>
|
|
|
|
<script>
|
|
export default {
|
|
data: () => ({
|
|
vertical: 'bottom',
|
|
horizontal: 'center',
|
|
duration: 4000
|
|
}),
|
|
methods: {
|
|
open() {
|
|
this.$refs.snackbar.open();
|
|
}
|
|
}
|
|
};
|
|
</script>
|