Vue.js 在提交表单时将响应添加到我的URL中
我正在使用Vue.js 在提交表单时将响应添加到我的URL中,vue.js,vuejs2,recaptcha,Vue.js,Vuejs2,Recaptcha,我正在使用vue-recaptcha并注意到,当我提交我的表单时,响应会污染我的URL,如下例所示: 我的URL/?g-recaptcha-response=03AGdBq24KB70qT57 有没有办法阻止这一切 index.html文件 <head> <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async
vue-recaptcha
并注意到,当我提交我的表单时,响应会污染我的URL
,如下例所示:
我的URL/?g-recaptcha-response=03AGdBq24KB70qT57
有没有办法阻止这一切
index.html文件
<head>
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
</head>
部件代码的一部分
<template>
<div class="form-group">
<vueRecaptcha sitekey="[MY-KEY-HERE]" :loadRecaptchaScript="true" @verify="reCaptcha" />
</div>
<div class="form-row d-flex justify-content-end">
<button type="submit" class="btn btn-success mr-2" @click="submitClicked">Submit</button>
</div>
</template>
<script>
import vueRecaptcha from 'vue-recaptcha';
components: {
vueRecaptcha
},
data() {
return {
reCaptchaResponse: ''
}
}
methods: {
reCaptcha(response) {
this.reCaptchaResponse = response;
},
submitClicked() {
this.formSubmittedLoader = true;
this.reCaptchaResponse = '';
setTimeout(() => {
this.formSubmittedLoader = false;
this.pageLoad();
grecaptcha.reset();
this.$eventHub.$emit('show-success-modal', { data: 'N/A', messageFor: 'contactUsSuccess' });
}, 1500);
}
</script>
提交
从“vue recaptcha”导入vueRecaptcha;
组成部分:{
vueRecaptcha
},
数据(){
返回{
重述共享响应:“”
}
}
方法:{
reCaptcha(回应){
this.reCaptchaResponse=响应;
},
submitClicked(){
this.formSubmittedLoader=真;
this.reCaptchaResponse='';
设置超时(()=>{
this.formSubmittedLoader=false;
这是pageLoad();
grecaptcha.reset();
此.$eventHub.$emit('show-success-modal',{data:'N/A',messageFor:'contactUsSuccess'});
}, 1500);
}