|
| 1 | +<template> |
| 2 | + <ElForm |
| 3 | + ref="form" |
| 4 | + :model="form" |
| 5 | + inline |
| 6 | + label-width="auto" |
| 7 | + label-position="left" |
| 8 | + @submit.native.prevent="helloNamePost(form.name)" |
| 9 | + > |
| 10 | + <h2>3. Hello, {name} (POST version)</h2> |
| 11 | + <ElFormItem label="Name"> |
| 12 | + <ElInput |
| 13 | + v-model="form.name" |
| 14 | + placeholder="Your name" |
| 15 | + data-cy="input-hello-name-post" |
| 16 | + /> |
| 17 | + </ElFormItem> |
| 18 | + <ElButton |
| 19 | + type="primary" |
| 20 | + data-cy="btn-hello-name-post" |
| 21 | + @click="helloNamePost(form.name)" |
| 22 | + > |
| 23 | + 👋 Say hello |
| 24 | + </ElButton> |
| 25 | + <ElButton |
| 26 | + type="danger" |
| 27 | + data-cy="btn-hello-name-post-error" |
| 28 | + @click="helloNamePostError(form.name)" |
| 29 | + > |
| 30 | + .$get() Error |
| 31 | + </ElButton> |
| 32 | + <p>Response: {{ response }}</p> |
| 33 | + <p v-if="error" style="color: red"> |
| 34 | + <strong>Error {{ error.status }}</strong> |
| 35 | + <br /> |
| 36 | + {{ error.data }} |
| 37 | + </p> |
| 38 | + </ElForm> |
| 39 | +</template> |
| 40 | + |
1 | 41 | <script>
|
2 | 42 | export default {
|
3 | 43 | name: 'Example3',
|
@@ -39,43 +79,3 @@ export default {
|
39 | 79 | },
|
40 | 80 | }
|
41 | 81 | </script>
|
42 | | - |
43 | | -<template> |
44 | | - <ElForm |
45 | | - ref="form" |
46 | | - :model="form" |
47 | | - inline |
48 | | - label-width="auto" |
49 | | - label-position="left" |
50 | | - @submit.native.prevent="helloNamePost(form.name)" |
51 | | - > |
52 | | - <h2>3. Hello, {name} (POST version)</h2> |
53 | | - <ElFormItem label="Name"> |
54 | | - <ElInput |
55 | | - v-model="form.name" |
56 | | - placeholder="Your name" |
57 | | - data-cy="input-hello-name-post" |
58 | | - /> |
59 | | - </ElFormItem> |
60 | | - <ElButton |
61 | | - type="primary" |
62 | | - data-cy="btn-hello-name-post" |
63 | | - @click="helloNamePost(form.name)" |
64 | | - > |
65 | | - 👋 Say hello |
66 | | - </ElButton> |
67 | | - <ElButton |
68 | | - type="danger" |
69 | | - data-cy="btn-hello-name-post-error" |
70 | | - @click="helloNamePostError(form.name)" |
71 | | - > |
72 | | - .$get() Error |
73 | | - </ElButton> |
74 | | - <p>Response: {{ response }}</p> |
75 | | - <p v-if="error" style="color: red"> |
76 | | - <strong>Error {{ error.status }}</strong> |
77 | | - <br /> |
78 | | - {{ error.data }} |
79 | | - </p> |
80 | | - </ElForm> |
81 | | -</template> |
0 commit comments