File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 14
14
< div id ="main ">
15
15
16
16
< h3 > {{ title }}</ h3 >
17
- < a @click ="titleReverse2() " class ="button "> swap</ a >
18
- <!--a @click="title = meth3(title)" class="button">swap</a-->
19
- < a @click ="titleReverse3() " class ="button "> swap</ a > <!-- all methods are async -->
17
+ < a @click ="(async()=> title = await meth2(title)) " class ="button "> swap</ a >
18
+ <!--a @click.async="title = meth3(title)" class="button">swap</a-->
19
+ < a @click ="(async()=> title = await meth3(title)) " class ="button "> swap</ a > <!-- all methods are async -->
20
+ < a @click ="asyncSet('title', meth3(title)) " class ="button "> swap</ a > <!-- all methods are async -->
20
21
< br />
21
22
22
23
We can have a state in Python which is a counter "i".
@@ -61,12 +62,8 @@ <h3>{{ title }}</h3>
61
62
}
62
63
} ,
63
64
methods : {
64
- async titleReverse2 ( ) { // to my knowledge, we cannot do await directly in @click
65
- this . title = await this . meth2 ( this . title )
66
- } ,
67
- async titleReverse3 ( ) { // to my knowledge, we cannot do await directly in @click
68
- this . title = await this . meth3 ( this . title )
69
- // ^^^^^ async even if in pyton it is a non-async method
65
+ async asyncSet ( attr , asyncVal ) {
66
+ this . $set ( this , attr , await asyncVal )
70
67
} ,
71
68
}
72
69
} )
You can’t perform that action at this time.
0 commit comments