【发布时间】:2018-04-18 23:35:45
【问题描述】:
这是我的 Vue 模板:
<form action="[path]/post.php" ref="vueForm" method="post">
<input type="hidden" name="hiddenfield" :value="newValue">
<input type="button" value="new value and submit" @click="changeVal(456)">
</form>
[..]
data() {
return {
newValue: 123
}
},
[..]
methods: {
changeVal (value) {
this.newValue = value
this.$refs.vueForm.submit()
}
}
还有 PHP 文件:
$getinfo = $_REQUEST['hiddenfield'];
echo $getinfo;
发布工作正常,但 PHP 打印 123。我想知道为什么它没有发布新值(应该是 456,如果我只更新文本输入而不发布表单,它会起作用)。
【问题讨论】:
标签: vue.js