@ -11,15 +11,34 @@ function noMultipleClicks(methods, info) {
} else {
methods();
}
setTimeout(()=> {
let timer = setTimeout(()=> {
that.noClick= true;
clearTimeout(timer)
}, 2000)
// 这里是重复点击的判断
// 节流函数
const throttle = (fn, t,_this) => {
console.log('throttle')
return ()=> {
if (!_this.timer) {
_this.timer = setTimeout(()=>{
fn()
console.log('fn')
//·清空定时器
_this.timer = null
}, t)
//导出
export default {
noMultipleClicks,//禁止多次点击
throttle
@ -36,6 +36,7 @@ export function createApp() {
app.use(uView)
app.component('comMessage', comMessage)
app.config.globalProperties.$noMultipleClicks = noclick.noMultipleClicks;
app.config.globalProperties.$throttle = noclick.throttle;
// startApp(app);
return {
app,
@ -36,7 +36,7 @@
<text>数量 : </text>
<view class="uni-flex uni-row uni-center" style="align-items: center;">
<input class="qty_input" v-model="allQty" :focus="true" type="number"
@confirm="confirm()" @input="checkNum" :maxlength="maxlength" />
@confirm="confirm()" @input="checkNum" :maxlength="maxlength" disabled :style="{background:'#f5f5f5',color:'#bbbbbb'}"/>
<uom :uom="dataContent.uom"></uom>
</view>
@ -5,10 +5,9 @@
<view class="page-wraper" v-if="detailSource.length>0">
<view class="page-header">
<view class="header_item">
来源库位 : {{fromLocationCode}}
<view class="header-view header_item">
<view class='split_line'></view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
@ -30,7 +30,7 @@
<view class="">
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
<button class="btn_single_commit" hover-class="btn_commit_after" @click="$throttle(commit,2000,this)()">提交</button>