this.page - 1,page的值也会跟着变,有点难受。
遇到一个问题。
如图1,this.page - 1,page的值也会跟着变,有点难受。
图2,是page定义的位置。

const x = this.pageconst p = x - 1
失败!
const x = this.page const p = x - 1
getTableData('小米', this.page - 1, this.size).then(res => { // console.log("数据:" + JSON.stringify(res.data))
const code = res.data.code if (code === 0) { this.total = res.data.data.totalElements this.page = res.data.data.number this.tableData = res.data.data.content console.log('total=' + this.total)
} else {
alert('出错' + res.data.msg)
}
}) data () { return { tableData: [], page: 1, size: 2, total: 0
}
}我让传入函数的值减1,page的值不变。
相关分类