[英]How to get value from input with dynamically changed value by jquery UI slider?
[英]NuxtJs get value from input changed by jquery
I have an input hidden in nuxtjs, and value update by jquery after get query from url, I wrote this part with jq but look like nuxtjs not read and get value that set by jquery, it already return null
after submit, but I want to获取 jq 设置的值。 但是,如果我在输入上写它可以正常工作并返回值,但是我想在页面加载时返回值,而不需要用户进行任何按键操作。
NuxtJs:
<input v-model="requestObj.case" name="case" type="text" value="" id="ServiceCase"/>
data() {
return {
requestObj: {
case: null,
},
}
}
methods: {
sendMail() { // this call when form submit
console.log(this.requestObj.case) // return null
}
}
jQuery:
我只能通过jq
更新value
$('#ServiceCase').val(s).attr('value',s).change();
Output:
<input name="case" type="text" value="Burglary" id="ServiceCase">
console: null
渴望 Output:
<input name="case" type="text" value="Burglary" id="ServiceCase">
console: Burglary
您只需在 model 中设置初始值,而不是在 html 中。 并且不要使用 jquery。 例如
data() {
return {
requestObj: {
case: 'Bulgaria',
},
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.