假设我有以下 q 输入:
<q-input
v-model="form.email"
inverted-light
color="white"
stack-label="Email:"
type="email"
@blur="$v.form.email.$touch"
:error="$v.form.email.$error"/>
Run Code Online (Sandbox Code Playgroud)
我希望能够做到这一点,如果电子邮件的域是mydomain.com表单操作将更改到另一个网站(没有 csrf 保护),并且 POST 将被发送到该网站而不是主要网站。
为此,我想我可以使用 jQuery。例如。$('#email').val().replace(/^.+@/, '') == 'mydomain.com'然后更改表单操作并提交。
唯一的问题是:我不知道如何id在q-input.
有任何想法吗?
小智 5
从 Quasar 1.4.2 早期(今年 11 月)开始,您可以使用“for”属性在 q-input 生成的结果 html 上指定 id 值(请参阅行为属性的末尾:https://quasar。 dev/vue-components/input#QInput-API)。
因此,例如,您可以添加for="myInputId":
<q-input
v-model="form.email"
inverted-light
color="white"
stack-label="Email:"
type="email"
@blur="$v.form.email.$touch"
:error="$v.form.email.$error"
for="myInputId"
/>
Run Code Online (Sandbox Code Playgroud)
值为“myInputField”的 id 属性将最终出现在<input>HTML 中的结果元素上。
| 归档时间: |
|
| 查看次数: |
1139 次 |
| 最近记录: |