File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed
Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" layout-padding" >
3+ <q-btn label =" Set Cookie A" no-caps @click =" add('a')" color =" primary" class =" q-ma-sm" />
4+ <q-btn label =" DEL Cookie A" no-caps @click =" del('a')" color =" primary" class =" q-ma-sm" />
5+ <q-btn label =" Set Cookie B" no-caps @click =" add('b')" color =" secondary" class =" q-ma-sm" />
6+ <q-btn label =" DEL Cookie B" no-caps @click =" del('b')" color =" secondary" class =" q-ma-sm" />
7+ <br >
8+ <q-btn label =" Refresh" no-caps @click =" refresh" color =" tertiary" class =" q-ma-sm" />
9+ <q-btn label =" DEL ssr_cookie" no-caps @click =" del('ssr_cookie')" color =" tertiary" class =" q-ma-sm" />
10+ <br ><br >
11+ <table class =" q-table striped" style =" width : 400px " >
12+ <thead >
13+ <tr >
14+ <th class =" text-left" >Cookie Name</th >
15+ <th class =" text-left" >Value</th >
16+ </tr >
17+ </thead >
18+
19+ <tbody >
20+ <tr v-for =" (value, name) in cookies" :key =" name" >
21+ <td >{{ name }}</td >
22+ <td >{{ value }}</td >
23+ </tr >
24+ </tbody >
25+ </table >
26+ </div >
27+ </template >
28+
29+ <script >
30+ export default {
31+ data () {
32+ return {
33+ cookies: this .$q .cookies .all ()
34+ }
35+ },
36+ methods: {
37+ refresh () {
38+ this .cookies = this .$q .cookies .all ()
39+ },
40+ add (name ) {
41+ this .$q .cookies .set (name, ' val' )
42+ this .refresh ()
43+ },
44+ del (name ) {
45+ this .$q .cookies .remove (name)
46+ this .refresh ()
47+ }
48+ },
49+ created () {
50+ if (this .$isServer ) {
51+ console .log (' setting ssr_cookie' )
52+ this .$q .cookies .set (' ssr_cookie' , ' yes' )
53+ }
54+ }
55+ }
56+ </script >
You can’t perform that action at this time.
0 commit comments