| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <template>
- <v-snackbar top v-model="visible" :color="color" :timeout="timeout">
- <v-icon left>{{ icon }}</v-icon> {{ msg }}
- <template v-slot:action="{ attr }">
- <v-btn text v-bind="attr" @click="visible = false">关 闭</v-btn>
- </template>
- </v-snackbar>
- </template>
- <script>
- export default {
- name: 'MsgKit',
- data: () => ({
- visible: false,
- msg: 'Hello, Friends!',
- color: 'teal',
- timeout: 2000,
- icon: 'mdi-check-circle-outline'
- }),
- methods: {
- normal (msg, color = '#2196F3', timeout = 2000, icon = 'mdi-information-outline') {
- this.visible = true
- this.msg = msg
- this.color = color
- this.timeout = timeout
- this.icon = icon
- },
- success (msg, timeout = 2000) {
- this.normal(msg, '#009688', timeout, 'mdi-check-circle-outline')
- },
- warning (msg, timeout = 2000) {
- this.normal(msg, '#673AB7', timeout, 'mdi-alert-octagram-outline')
- },
- error (msg, timeout = 2000) {
- this.normal(msg, '#C62828', timeout, 'mdi-sticker-remove-outline')
- }
- }
- }
- </script>
|