<script> export default { data() { return { form: {} } }, props: { id:'' }, watch: { 'id': function () { this.loadData();//watch監聽props傳來id的變化 } }, created() { this.loadData(); }, methods: { loadData() { var data = { bidding_payment_id: this.id } this.$post('/goods/bidding/payment/detail', data, (res) => { console.log('444', res) if (!res.status) { this.$message.error(res.message || '暫無數據!'); return; } this.form = res.data // this.form.amount_1 = this.form.amount / 100 || ''; // this.form.freight_1 = this.form.freight / 100 || 0; this.form.payment_time = this.loadTimeString(this.form.payment_time); this.form.refund_time = this.loadTimeString(this.form.refund_time); }) },
傳值時要注意參數的類型!post