Commit f8723115 by 张立顺

修复重复点击的问题

1 parent 7ebee955
......@@ -16,6 +16,26 @@
<script>
export default {
name: 'BaseDialog',
directives: {
// 函数节流 监控输入框 提高性能
throttle: {
// 指令的定义
inserted: function (el, obj) {
let timerId = null
let flag = true
el.addEventListener('click', function () {
if (!flag) return
flag = false
timerId && clearTimeout(timerId)
timerId = setTimeout(function () {
flag = true
// 调用绑定在v-throttle上的方法search
obj.value()
}, 1000)
})
}
}
},
props: {
dialogConfig: {
required: false,
......
......@@ -92,6 +92,7 @@ export default {
data() {
return {
// addressInfo: {},
throttleSubmit: false,
membraneTypeList,
drawer: false,
dialogShow: false,
......@@ -192,9 +193,13 @@ export default {
} else {
this.selectList = selectList
this.dialogShow = true
this.throttleSubmit = false
}
},
handleSubmit() {
if (this.throttleSubmit) return
console.log(this.throttleSubmit)
console.log('submit')
const { contactAddress, contactName, contactPhone } = this.addressInfo
const params = {
orderDelivery: {
......@@ -204,11 +209,15 @@ export default {
}
// console.log(params)
// return
this.throttleSubmit = true
purchaseOrderAdd(params).then((result) => {
this.$message.success('提交成功')
this.getGoodsList()
this.drawer = false
this.dialogShow = false
this.$message.success('提交成功')
this.getGoodsList()
// this.$nextTick(() => {
// this.throttleSubmit = false
// }, 1000)
})
// purchaseOrderAdd
// this.getGoodsList()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!