发布vue.js表单时,无法在php中获取$post

发布vue.js表单时,无法在php中获取$post,vue.js,form-submit,Vue.js,Form Submit,我在vue.js中有一个带有动态行的表单,我使用一个经典的HTML表单标记在php页面中获得结果 我在Php中的输出没有按预期显示$post。 A.有表格可供查阅 我的代码如下: <?php echo '$post detail'; foreach ($_POST as $key => $value) echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>"; ?> h

我在vue.js中有一个带有动态行的表单,我使用一个经典的HTML表单标记在php页面中获得结果

我在Php中的输出没有按预期显示$post。 A.有表格可供查阅

我的代码如下:

<?php
echo '$post detail';
foreach ($_POST as $key => $value)
 echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";
?>
html


日期
账户
借方
信用
添加行
合计D.:{{totaldebit | roundme}
总客户:{totalcredit | roundme}
Dif:{{totaldebit totalcredit | roundme}}
邮递
我有以下脚本:

<script>

Vue.filter('roundme', function (value) {
  return value.toFixed(3);
})

Vue.component('v-select', VueSelect.VueSelect);
var app = new Vue({
  el: "#app",
  data: {
    rows: [{debit:0, credit:0},

    ]
  },
    computed: {
    totaldebit() {
        return this.rows.reduce((total, row) => {
          return total + Number(row.debit);
        }, 0);
      },

      totalcredit() {
        return this.rows.reduce((total, row) => {
          return total + Number(row.credit);
        }, 0);
      }
  },
  methods: {
    addRow: function() {
      this.rows.push({myDate:"",
      account:"",
        debit: "",
        credit: ""
      });
    },
    removeRow: function(row) {
      //console.log(row);
      this.rows.$remove(row);
    },
    isNumber: function(evt) {
      evt = (evt) ? evt : window.event;
      var charCode = (evt.which) ? evt.which : evt.keyCode;
      if ((charCode > 31 && (charCode < 48 || charCode > 57)) && charCode !== 46) {
        evt.preventDefault();;
      } else {
        return true;
      }
    }
  }
});

</script>

Vue.filter('roundme',函数(值){
返回值。toFixed(3);
})
Vue.component('v-select',VueSelect.VueSelect);
var app=新的Vue({
el:“应用程序”,
数据:{
行:[{借方:0,贷方:0},
]
},
计算:{
totaldebit(){
返回此.rows.reduce((总计,行)=>{
返回总计+编号(第行借方);
}, 0);
},
totalcredit(){
返回此.rows.reduce((总计,行)=>{
返回总数+数量(行积分);
}, 0);
}
},
方法:{
addRow:function(){
this.rows.push({myDate:“”,
账户:“,
借方:“,
信用证:“
});
},
移除方式:功能(行){
//控制台日志(行);
此.rows.$remove(row);
},
isNumber:功能(evt){
evt=(evt)?evt:window.event;
var charCode=(evt.which)?evt.which:evt.keyCode;
如果((字符编码>31&&(字符编码<48 | |字符编码>57))&&charCode!==46){
evt.preventDefault();;
}否则{
返回true;
}
}
}
});
我的php页面操作页面如下:

<?php
echo '$post detail';
foreach ($_POST as $key => $value)
 echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";
?>

只需将name属性添加到输入中即可

<input class="form-control" type="date" name="date" v-model="row.myDate">

或动力学

<input class="form-control" type="date" :name="'date'+index" v-model="row.myDate">

尝试此操作并在浏览器开发工具中检查结果