Vue.js 中 calculationAmount 为什么没有被 acTaxtableAmount() 方法调用
可能的原因是计算 calculationAmount 的方法 calculationacTaxableAmount() 没有被调用。请确保在适当的地方调用了这个方法。
另外,确保在模板中正确地绑定了 calculationAmount,以便在调用 acTaxtableAmount() 方法时,能够正确地传递该值。
代码示例:
<template>
<el-form-item
label='应纳税所得额:'
prop='acTaxPiPersonCalculationSchedule.acTaxableIncome'
style='width: 290px'
>
{{calculationAmount}}
</el-form-item>
</template>
<script>
export default {
data() {
return {
calculationAmount: 0,
form: {
income: 0,
cost: 0,
taxExemptIncome: 0,
subtotal: 0
}
}
},
methods: {
calculationacTaxableAmount() {
this.calculationAmount = this.form.income - this.form.cost - this.form.taxExemptIncome - this.form.subtotal
this.acTaxtableAmount(this.calculationAmount)
},
acTaxtableAmount(TaxtableAmount) {
console.log(TaxtableAmount, 'TaxtableAmount')
}
}
}
</script>
确保在合适的位置调用 calculationacTaxableAmount() 方法,例如在 created 生命周期钩子中。
created() {
this.calculationacTaxableAmount()
}
确保 calculationAmount 在模板中正确绑定。
另外,请检查 acTaxtableAmount 方法的调用时机是否正确,例如是否应该在 calculationAmount 计算完成之后才调用。
原文地址: http://www.cveoy.top/t/topic/b90S 著作权归作者所有。请勿转载和采集!