Blame view

src/pages/ui/Snackbar.vue 3.02 KB
8ab31dc8b   Jatinder Singh   changes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
  <template>
    <div id="page-snackbar">
      <v-container grid-list-xl fluid>
        <v-layout row wrap>
          <v-flex lg12 sm12>
            <v-widget title="Basic Usage">
              <section slot="widget-content">
                <v-container fluid>
                  <v-layout row wrap>
                    <v-flex xs12>
                      <v-radio-group v-model="color" row>
                        <v-radio
                          v-for="(colorValue, i) in ['success', 'info', 'error', 'cyan darken-2']"
                          :key="i"
                          :value="colorValue"
                          :label="colorValue"
                          :color="colorValue"
                        ></v-radio>
                      </v-radio-group>
                    </v-flex>                  
                    <v-flex xs12 sm3>
                      <v-checkbox v-model="x" value="left" label="Left"></v-checkbox>
                    </v-flex>
                    <v-flex xs6 sm3>
                      <v-checkbox v-model="x" value="right" label="Right"></v-checkbox>
                    </v-flex>
                    <v-flex xs6 sm3>
                      <v-checkbox v-model="y" value="top" label="Top"></v-checkbox>
                    </v-flex>
                    <v-flex xs6 sm3>
                      <v-checkbox v-model="y" value="bottom" label="Bottom"></v-checkbox>
                    </v-flex>
                    <v-flex xs12 sm3>
                      <v-checkbox v-model="mode" value="multi-line" label="Multi-line (mobile)"></v-checkbox>
                    </v-flex>
                    <v-flex xs12 sm3>
                      <v-checkbox v-model="mode" value="vertical" label="Vertical (mobile)"></v-checkbox>
                    </v-flex>
                    <v-flex xs12 sm4>
                      <v-text-field v-model="text" type="text" label="Text"></v-text-field>
                    </v-flex>
                    <v-flex xs12 sm4>
                      <v-text-field v-model.number="timeout" type="number" label="Timeout"></v-text-field>
                    </v-flex>
                  </v-layout>
  
                </v-container>
                <v-btn block color="primary" @click.native="snackbar = true" dark>Show Snackbar</v-btn>              
              </section>
            </v-widget>
          </v-flex>
        </v-layout>
      </v-container>
      <v-snackbar
        :timeout="timeout"
        :color="color"
        :top="y === 'top'"
        :bottom="y === 'bottom'"
        :right="x === 'right'"
        :left="x === 'left'"
        :multi-line="mode === 'multi-line'"
        :vertical="mode === 'vertical'"
        v-model="snackbar"
      >
        {{ text }}
        <v-btn flat icon dark @click.native="snackbar = false"><v-icon>close</v-icon></v-btn>
      </v-snackbar>    
    </div>
  </template>
  
  <script>
  import VWidget from '@/components/VWidget';
  export default {
    components: {
      VWidget
    },
    data () {
      return {
        snackbar: false,
        y: 'top',
        x: null,
        mode: '',
        timeout: 6000,
        color: '',
        text: 'Hello, I\'m a snackbar'      
      };
    },
    computed: {
    },  
    methods: {
    }
  };
  </script>