|
7 | 7 |
|
8 | 8 | <div slot="api"> |
9 | 9 | <api-table name="md-snackbar"> |
10 | | - |
| 10 | + <md-table slot="properties"> |
| 11 | + <md-table-header> |
| 12 | + <md-table-row> |
| 13 | + <md-table-head>Name</md-table-head> |
| 14 | + <md-table-head>Type</md-table-head> |
| 15 | + <md-table-head>Description</md-table-head> |
| 16 | + </md-table-row> |
| 17 | + </md-table-header> |
| 18 | + |
| 19 | + <md-table-body> |
| 20 | + <md-table-row> |
| 21 | + <md-table-cell>md-position</md-table-cell> |
| 22 | + <md-table-cell><code>String</code></md-table-cell> |
| 23 | + <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> |
| 24 | + </md-table-row> |
| 25 | + |
| 26 | + <md-table-row> |
| 27 | + <md-table-cell>md-duration</md-table-cell> |
| 28 | + <md-table-cell><code>Number</code></md-table-cell> |
| 29 | + <md-table-cell>The duration visibility in miliseconds. Default: <code>4000</code></md-table-cell> |
| 30 | + </md-table-row> |
| 31 | + </md-table-body> |
| 32 | + </md-table> |
| 33 | + |
| 34 | + <md-table slot="events"> |
| 35 | + <md-table-header> |
| 36 | + <md-table-row> |
| 37 | + <md-table-head>Name</md-table-head> |
| 38 | + <md-table-head>Value</md-table-head> |
| 39 | + <md-table-head>Description</md-table-head> |
| 40 | + </md-table-row> |
| 41 | + </md-table-header> |
| 42 | + |
| 43 | + <md-table-body> |
| 44 | + <md-table-row> |
| 45 | + <md-table-cell>open</md-table-cell> |
| 46 | + <md-table-cell>None</md-table-cell> |
| 47 | + <md-table-cell>Triggered when the snackbar open.</md-table-cell> |
| 48 | + </md-table-row> |
| 49 | + |
| 50 | + <md-table-row> |
| 51 | + <md-table-cell>close</md-table-cell> |
| 52 | + <md-table-cell>None</md-table-cell> |
| 53 | + <md-table-cell>Triggered when the snackbar closes.</md-table-cell> |
| 54 | + </md-table-row> |
| 55 | + </md-table-body> |
| 56 | + </md-table> |
| 57 | + |
| 58 | + <md-table slot="methods"> |
| 59 | + <md-table-header> |
| 60 | + <md-table-row> |
| 61 | + <md-table-head>Name</md-table-head> |
| 62 | + <md-table-head>Description</md-table-head> |
| 63 | + </md-table-row> |
| 64 | + </md-table-header> |
| 65 | + |
| 66 | + <md-table-body> |
| 67 | + <md-table-row> |
| 68 | + <md-table-cell>open</md-table-cell> |
| 69 | + <md-table-cell>Opens the Snackbar.</md-table-cell> |
| 70 | + </md-table-row> |
| 71 | + |
| 72 | + <md-table-row> |
| 73 | + <md-table-cell>close</md-table-cell> |
| 74 | + <md-table-cell>Closes the Snackbar.</md-table-cell> |
| 75 | + </md-table-row> |
| 76 | + </md-table-body> |
| 77 | + </md-table> |
11 | 78 | </api-table> |
12 | 79 | </div> |
13 | 80 |
|
14 | 81 | <div slot="example"> |
15 | 82 | <example-box card-title="Default"> |
16 | 83 | <div slot="demo"> |
17 | | - <div> |
18 | | - <md-button class="md-primary md-raised" @click="$refs.snackbar1.open()">Open bottom center</md-button> |
19 | | - <md-button class="md-primary md-raised" @click="$refs.snackbar2.open()">Open bottom left</md-button> |
20 | | - <md-button class="md-primary md-raised" @click="$refs.snackbar3.open()">Open bottom right</md-button> |
21 | | - </div> |
22 | | - |
23 | | - <div> |
24 | | - <md-button class="md-primary md-raised" @click="$refs.snackbar4.open()">Open top center</md-button> |
25 | | - <md-button class="md-primary md-raised" @click="$refs.snackbar5.open()">Open top left</md-button> |
26 | | - <md-button class="md-primary md-raised" @click="$refs.snackbar6.open()">Open top right</md-button> |
27 | | - </div> |
28 | | - |
29 | | - <md-snackbar md-position="bottom center" ref="snackbar1"> |
30 | | - <span>Connection timeout. Showing limited messages.</span> |
31 | | - <md-button class="md-accent" v-md-theme="'light-blue'" @click="$refs.snackbar1.close()">Retry</md-button> |
32 | | - </md-snackbar> |
33 | | - |
34 | | - <md-snackbar md-position="bottom left" ref="snackbar2"> |
35 | | - <span>Connection timeout. Showing limited messages.</span> |
36 | | - <md-button class="md-accent" v-md-theme="'light-blue'" @click="$refs.snackbar2.close()">Retry</md-button> |
37 | | - </md-snackbar> |
38 | | - |
39 | | - <md-snackbar md-position="bottom right" ref="snackbar3"> |
40 | | - <span>Connection timeout. Showing limited messages.</span> |
41 | | - <md-button class="md-accent" v-md-theme="'light-blue'" @click="$refs.snackbar3.close()">Retry</md-button> |
42 | | - </md-snackbar> |
43 | | - |
44 | | - <md-snackbar md-position="top center" ref="snackbar4"> |
45 | | - <span>Connection timeout. Showing limited messages.</span> |
46 | | - <md-button class="md-accent" v-md-theme="'light-blue'" @click="$refs.snackbar4.close()">Retry</md-button> |
47 | | - </md-snackbar> |
48 | | - |
49 | | - <md-snackbar md-position="top left" ref="snackbar5"> |
50 | | - <span>Connection timeout. Showing limited messages.</span> |
51 | | - <md-button class="md-accent" v-md-theme="'light-blue'" @click="$refs.snackbar5.close()">Retry</md-button> |
52 | | - </md-snackbar> |
53 | | - |
54 | | - <md-snackbar md-position="top right" ref="snackbar6"> |
55 | | - <span>Connection timeout. Showing limited messages.</span> |
56 | | - <md-button class="md-accent" v-md-theme="'light-blue'" @click="$refs.snackbar6.close()">Retry</md-button> |
57 | | - </md-snackbar> |
| 84 | + <form novalidate @submit.stop.prevent="open"> |
| 85 | + <div> |
| 86 | + <div class="md-body-2">Vertical</div> |
| 87 | + <md-radio v-model="vertical" id="top" name="snackbar-vertical" md-value="top">top</md-radio> |
| 88 | + <md-radio v-model="vertical" id="bottom" name="snackbar-vertical" md-value="bottom">bottom</md-radio> |
| 89 | + </div> |
| 90 | + |
| 91 | + <div> |
| 92 | + <div class="md-body-2">Horizontal</div> |
| 93 | + <md-radio v-model="horizontal" id="left" name="snackbar-horizontal" md-value="left">left</md-radio> |
| 94 | + <md-radio v-model="horizontal" id="center" name="snackbar-horizontal" md-value="center">center</md-radio> |
| 95 | + <md-radio v-model="horizontal" id="right" name="snackbar-horizontal" md-value="right">right</md-radio> |
| 96 | + </div> |
| 97 | + |
| 98 | + <div> |
| 99 | + <div class="md-body-2">Delay</div> |
| 100 | + |
| 101 | + <md-input-container> |
| 102 | + <md-input type="number" v-model="duration"></md-input> |
| 103 | + </md-input-container> |
| 104 | + </div> |
| 105 | + |
| 106 | + <md-button type="submit" class="md-primary md-raised">Open Snackbar</md-button> |
| 107 | + |
| 108 | + <md-snackbar :md-position="vertical + ' ' + horizontal" ref="snackbar" :md-duration="duration"> |
| 109 | + <span>Connection timeout. Showing limited messages.</span> |
| 110 | + <md-button class="md-accent" md-theme="light-blue" @click="$refs.snackbar.close()">Retry</md-button> |
| 111 | + </md-snackbar> |
| 112 | + </form> |
58 | 113 | </div> |
59 | 114 |
|
60 | 115 | <div slot="code"> |
61 | 116 | <code-block lang="xml"> |
| 117 | + <form novalidate @submit.stop.prevent="open"> |
| 118 | + <div> |
| 119 | + <div class="md-body-2">Vertical</div> |
| 120 | + <md-radio v-model="vertical" id="top" name="snackbar-vertical" md-value="top">top</md-radio> |
| 121 | + <md-radio v-model="vertical" id="bottom" name="snackbar-vertical" md-value="bottom">bottom</md-radio> |
| 122 | + </div> |
| 123 | + |
| 124 | + <div> |
| 125 | + <div class="md-body-2">Horizontal</div> |
| 126 | + <md-radio v-model="horizontal" id="left" name="snackbar-horizontal" md-value="left">left</md-radio> |
| 127 | + <md-radio v-model="horizontal" id="center" name="snackbar-horizontal" md-value="center">center</md-radio> |
| 128 | + <md-radio v-model="horizontal" id="right" name="snackbar-horizontal" md-value="right">right</md-radio> |
| 129 | + </div> |
| 130 | + |
| 131 | + <div> |
| 132 | + <div class="md-body-2">Delay</div> |
| 133 | + |
| 134 | + <md-input-container> |
| 135 | + <md-input type="number" v-model="duration"></md-input> |
| 136 | + </md-input-container> |
| 137 | + </div> |
| 138 | + |
| 139 | + <md-button type="submit" class="md-primary md-raised">Open Snackbar</md-button> |
| 140 | + |
| 141 | + <md-snackbar :md-position="vertical + ' ' + horizontal" ref="snackbar" :md-duration="duration"> |
| 142 | + <span>Connection timeout. Showing limited messages.</span> |
| 143 | + <md-button class="md-accent" md-theme="light-blue" @click="$refs.snackbar.close()">Retry</md-button> |
| 144 | + </md-snackbar> |
| 145 | + </form> |
| 146 | + </code-block> |
62 | 147 |
|
| 148 | + <code-block lang="javacript"> |
| 149 | + export default { |
| 150 | + data: () => ({ |
| 151 | + vertical: 'bottom', |
| 152 | + horizontal: 'center', |
| 153 | + duration: 4000 |
| 154 | + }), |
| 155 | + methods: { |
| 156 | + open() { |
| 157 | + this.$refs.snackbar.open(); |
| 158 | + } |
| 159 | + } |
| 160 | + }; |
63 | 161 | </code-block> |
64 | 162 | </div> |
65 | 163 | </example-box> |
|
74 | 172 |
|
75 | 173 | <script> |
76 | 174 | export default { |
77 | | -
|
| 175 | + data: () => ({ |
| 176 | + vertical: 'bottom', |
| 177 | + horizontal: 'center', |
| 178 | + duration: 4000 |
| 179 | + }), |
| 180 | + methods: { |
| 181 | + open() { |
| 182 | + this.$refs.snackbar.open(); |
| 183 | + } |
| 184 | + } |
78 | 185 | }; |
79 | 186 | </script> |
0 commit comments